[Live-devel] A question regarding the timing of doGetNextFrame

Ben Rush ben at ben-rush.net
Sat Feb 6 13:03:01 PST 2016


Hello,

I have been experimenting with live555 for a week now and have had a high
level of success in using it to stream h264 video from a camera. Now I want
to add audio and I'm having some issues.

I've read through a lot of the forum content related to this and I'm either
doing something peculiar, or I missed something along the way (I'm using
Windows, by the way). I have my server setup like this:

    TaskScheduler* taskSchedular = BasicTaskScheduler::createNew();
    BasicUsageEnvironment* usageEnvironment =
BasicUsageEnvironment::createNew(*taskSchedular);
    RTSPServer* rtspServer = RTSPServer::createNew(*usageEnvironment, 8554,
NULL);
    if (rtspServer == NULL)
    {
        *usageEnvironment << "Failed to create rtsp server ::" <<
usageEnvironment->getResultMsg() << "\n";
        exit(1);
    }

    std::string streamName = "feynman";
    ServerMediaSession* sms =
ServerMediaSession::createNew(*usageEnvironment, streamName.c_str(),
streamName.c_str(), "Live H264 Stream");
    H264LiveServerMediaSession *liveSubSession =
H264LiveServerMediaSession::createNew(*usageEnvironment, false);
    sms->addSubsession(liveSubSession);
    WindowsAudioMediaSession* audioSession =
WindowsAudioMediaSession::createNew(*usageEnvironment, false);
    sms->addSubsession(audioSession);
    rtspServer->addServerMediaSession(sms);
    char* url = rtspServer->rtspURL(sms);
    *usageEnvironment << "Play the stream using url " << url << "\n";
    delete[] url;
    taskSchedular->doEventLoop();

When just the WindowsAudioMediaSession session is enabled (I comment out
the adding of the H264LiveServerMediaSession as a sub session), audio works
just fine. I can hear it, it's clear, and we're all good. doGetNextFrame
for my AudioInputDevice gets called many times as a second as well. Again,
as expected.

However, the moment I add back in my video stream (which works just fine on
its own as well), my AudioInputDevice's doGetNextFrame() is called, maybe,
once a second. Video continues to stream just fine (and my FramedSource for
video is called as frequently as before), but the audio fails.

I have seen from reading the lists that care must be taken to ensure the
timing is correct between the two streams, but I believe I'm running into a
bigger problem since the server just stops calling my AudioInputDevice as
frequently the moment both sessions are enabled .

Do you have any insight into why this might be happening? What am I doing
wrong? Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20160206/32cfde40/attachment.html>


More information about the live-devel mailing list