[Live-devel] H264VideoFileServerMediaSubsession and doEventLoop

Rafael Lorenzo Alonso rafaellorenzo at sepsa.es
Fri Apr 1 03:50:29 PDT 2011


Hi,

First of all, congratulations for such a great library.

We're working on a RTSPServer of H264 video from several RTP flows using 
your library. We're facing some problems most of them we have found 
solutions for but we have one we think is specially difficult for us to 
resolve without some help.

In particular, the problem concerns the function getAuxSDPLine. In the 
following line: envir().taskScheduler().doEventLoop(&fDoneFlag);

char const* H264VideoFileServerMediaSubsession::getAuxSDPLine(RTPSink* 
rtpSink, FramedSource* inputSource) {
    // Note: For H264 video files, the 'config' information 
("profile-level-id" and "sprop-parameter-sets") isn't known
    // until we start reading the file.  This means that "rtpSink"s 
"auxSDPLine()" will be NULL initially,
    // and we need to start reading data from our file until this changes.
    fDummyRTPSink = rtpSink;

    // Start reading the file:
    fDummyRTPSink->startPlaying(*inputSource, afterPlayingDummy, this);

    // Check whether the sink's 'auxSDPLine()' is ready:
    checkForAuxSDPLine(this);

    envir().taskScheduler().doEventLoop(&fDoneFlag);

    char const* auxSDPLine = fDummyRTPSink->auxSDPLine();
    return auxSDPLine;
}

This stops there until the H264VideoStreamFramer gets from the video the 
SPS and PPS (NALs 7 and 8).

We have made a version of the H264VideoFileServerMediaSubsession that 
takes the H264 video from an H264VideoRTPSource instead taking it from a 
file. The RTP video flow we use comes from network cameras that 
unfortunately don't send such NAL's (first problem). We have bypass that 
error inheriting H264VideoStreamDiscreteFramer allowing to set manually 
SPS and PPS in the constructor.

Anyway, our main problem is that if the client subsession ends (TEARDOWN 
or TIMEOUT) the object is deleted while waiting in that line checking 
for a variable of the deleted object.

In the library as it is the problem is dificult to induce as this 
function will return very quick, as soon as the file is read from the 
disk. Maybe if the file doesn't contain any NAL unit 7 and 8 and is big 
enough to allow the client TEARDOWN/TIMEOUT the session in time, could 
end up occurring but it is not very likely.

In our case the problem is much more probable as the RTP video could be 
o not in the network, forcing the H264VideoRTPSouce to wait forever, 
ending up in a stack overflow after having many sessions blocked in 
doEventLoops.

Do you think there is any possibility of doing this another way?

I think this is a problem derived of not using threads and that could be 
happening across the library in some other points. Maybe this can be 
solved by making the doEventLoop function being able to return an error 
if the object it trusts is been destroyed (making a call in the 
destructor of that object to unblock the possible doEventLoop call). Do 
you think this could be a solution somehow?

Sorry for my English, it's been a while since I don't use it...

Best regards,
Rafael Lorenzo.
Infrastructure Software Engineer.
SEPSA SCI, Albatros Corporation.


More information about the live-devel mailing list