[Live-devel] doGetNextFrame() timing in mpeg2ts context
Horst Weglanz
weglanz12 at yahoo.com
Fri Nov 14 06:47:28 PST 2008
Thank you,
I added a static hook to schedule another *doGetNextFrame()* call and it's working as expected. Except for one thing which seems to be an issue with my usage of the TaskScheduler. I added a ByteStreamFileSource to the output video and the funny thing is: scheduled events from the ByteStreamFileSource immediately stop being executed when the first data is available in MySource. These are different objects and in in MySource I do the following:
every time data available:
nextTask() = envir().taskScheduler().scheduleDelayedTask(0,(TaskFunc*)FramedSource::afterGetting, this);
every time no data available:
nextTask() = envir().taskScheduler().scheduleDelayedTask(100,(TaskFunc*)MySource::doGetNextFrameStatic, this);
and in the ByteStreamFileSource there is also this frequent call:
nextTask() = envir().taskScheduler().scheduleDelayedTask(0,(TaskFunc*)FramedSource::afterGetting, this);
Both sources do work alone and there is nothing wrong with the FileSource, the problems occurs only when two video sources being read in parallel. When I start my application usually data in MySource isn't instantly available so every time there is *no data* -> so it schedules doGetNextFrameStatic(). At the same time data from the ByteFileSource is being read. After it has read it's frame, it schedules the next frame to *FramedSource::afterGetting(this)* which is being called. The problems occurs the moment data in MySource is available and this object also schedules a call to *FramedSource::afterGetting(this)* -- it seams it somehow overwrites the call from ByteStreamFileSource to read the next frame; of course the function pointer is probably the same but the *this* parameter is different and *nextTask()* should point to a different TaskToken since they are both different objects.
What is going wrong here? Do I have to handle things differently when adding multiple video streams or where lies my mistake?
Thank you very much,
HW
----- Original Message ----
From: Ross Finlayson <finlayson at live555.com>
To: LIVE555 Streaming Media - development & use <live-devel at ns.live555.com>
Sent: Thursday, November 13, 2008 7:13:20 PM
Subject: Re: [Live-devel] doGetNextFrame() timing in mpeg2ts context
> Is there maybe a way to directly schedule a call to *doGetNextFrame()* in the event loop since this is not a static function or what would be the alternative
The alternative is to write a static member function that then calls "doGetNextFrame()", and have "scheduleDelayedTask()" arrange to call the static member function. There are several examples of this in the code already.
Also, as I noted last time, you should not call "usleep(10)"; instead, pass 10 as the (delay) parameter to "scheduleDelayedTask()".
More information about the live-devel
mailing list