[Live-devel] Custom memory buffer source

sampsa sampsa.riikonen at dasys.fi
Thu Sep 15 07:15:50 PDT 2016


Hi,

I have a custom source, based on the "MyByteStreamMemoryBufferSource"

Frames appear to this source most of the time in frame "bursts" .. first 
no frames, then suddenly a lots of them

In pseudocode:
----------------
// Sources/Filters:
bytesource 
=MyByteStreamMemoryBufferSource::createNew(env,(uint8_t*)(buf),len,False,0,0);
videoSource  =H264VideoStreamDiscreteFramer::createNew(env, bytesource);
// connection: bytesource -> videoSource [filter]

// Sinks:
videoSink    =H264VideoRTPSink::createNew(env, rtpGroupsock, 96);

videoSink->startPlaying(*(videoSource), afterPlaying, [pars to 
afterPlaying]);
// connection: videSource [filter] -> videoSink
---------------

So, after startPlaying, "videoSink" starts pinging videoSource and 
running bytesource's "doGetNextFrame".

In the case data has arrived to bytesource, I have to call in 
bytesource's "doGetNextFrame" method:

FramedSource::afterGetting(this);

However, as videosink pings bytesource's "doGetNextFrame" constantly, 
there are instants when data has not yet arrived to bytesource's memory 
buffer.
What am I supposed to do in such case..?

* Of course, I can't do a straight "return" from "doGetNextFrame" .. 
that would break up the re-scheduling.
* Something along the lines
envir().taskScheduler().scheduleDelayedTask(0,(TaskFunc*)FramedSource::afterGetting, 
this);
   .. i.e. scheduling via the event loop, maybe ? (but there is still a 
problem - see the next point)
* Actually, I'd prefer not to call FramedSource::afterGetting at all, 
because there is no data, i.e. the fFrameSize=0 (!)
* .. and blocking the call to FramedSource::afterGetting(this) until 
data has arrive to bytesource's memory buffer blocks the live555 event loop

What is the sane/standard way of doing this?  Or maybe I have 
misunderstood something fundamental ..


Regards,

Sampsa




More information about the live-devel mailing list