[Live-devel] What to do if data not coming while streaming from memory

Xuan lkxkfl at hotmail.com
Wed Jul 30 00:11:55 PDT 2014


Hi,

H.264 and AAC frames are generated and put into 2 CLists in memory. Two
classes are implemented to get frames from memory, live this:

void ADTSRealTimeStreamSource::doGetNextFrame()

{

if(fAVPktList->empty()){                                   //if no frames in
CList, sleep until CList is not empty.

                   clock_t loopStart,loopEnd,interval= 0;

                   clock_t begin = clock();

                   while(fAVPktList->empty())               {

                            loopStart = clock();

                            Sleep(WAITING_TIME_IN_LOOP);

                            loopEnd  = clock();

                            interval += (loopEnd-loopStart);

                            if(interval>60000)

                                     break;

                   }

                   clock_t end = clock();

                   int num = fAVPktList->size();

                   if(!num)             {

                            handleClosure();

                            return;

                   }

         }

...

}

Maybe the speed of streaming frames is much faster than the speed of
generating frames. So when function "doGetNextFrame()" is called, no frame
is put into memory. If I use sleep() to wait for frames, thread blocks and
streaming AAC frames slowns down.

So What should I do  to  ensure both AAC and H.264 to streamed well when no
frames come?

Thanks for your reply!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140730/a87408cd/attachment.html>


More information about the live-devel mailing list