[Live-devel] Custom memory buffer source

sampsa sampsa.riikonen at dasys.fi
Thu Sep 15 12:11:14 PDT 2016


As a second thought, I guess I just do a plain "return" in 
doGetNextFrame if there is no data ..

.. and then do as the faq says, i.e. arrange 
FramedSource::afterGetting(this) call once there _is_ data, right?

Sorry for the spam!

On 15.09.2016 17:15, sampsa wrote:
> 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
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel



More information about the live-devel mailing list