[Live-devel] StreamReplicator with FileSink problem

Bruno Abreu bruno.abreu at livingdata.pt
Tue Jan 22 11:09:56 PST 2013


On Tue, 22 Jan 2013 10:08:49 -0800, Ross Finlayson wrote
> OK, so I'll make that change (changing the order of the calls to 
> "onSourceClosure(this);" and "stopPlaying();" in 
> "FileSink::afterGettingFrame()") in the next release of the software.
> 
> > The main difference - regarding this issue - between our server and the
> > testReplicator app is that, after an error occurs trying to write a video file,
> > we schedule the writing to start again at a later time. We do that by overriding
> > the MediaSink::stopPlaying method in our own FileSink class:
> > 
> > virtual void stopPlaying() {
> >  MediaSink::stopPlaying();
> > 
> >  // schedule to restart in 10 secs
> >  envir() << "OurFileSink stopped! Scheduling to restart in 10 secs.\n";
> >  envir().taskScheduler().scheduleDelayedTask(10000000,
> >      (TaskFunc *) OurFileSink::startPlaying, this);
> > }
> 
> No - that's a bad idea.  You shouldn't be redefining a virtual 
> function to do something completely unrelated to what the rest of the 
> code - that calls this virtual function - expects.  (That's why you 
> keep running into trouble :-)
> 
> The right place to be scheduling a new 'playing' task is in your 
> 'after playing' function - i.e., the function that you passed as a 
> parameter when you called "startPlaying()" on your "FileSink" 
> subclass.  That 'after playing' function will get called,
>  automatically, when writes to the file fail (or if the input stream 
> closes) - as a result of the call to "onSourceClosure(this);".  So 
> that's where you should be scheduling your new task.

Initially we were scheduling in afterPlaying function, but your suggestion of
reordering sets fAfterFunc to NULL in MediaSink::stopPlaying() before it gets
called in MediaSink::onSourceClosure().
We think the correct behavior would be to call stopGettingFrames on fSource
which will call doStopGettingFrames() on the specific replica and also have the
afterPlaying() function get called to make the scheduling.


> > I'm attaching the StreamReplicator class with our patches
> 
> I didn't see any attachment!

You're right, I'm sorry. Sending the files now.


> > 2.
> > Also, we needed to change the visibility of the FileSink::continuePlaying()
> > method to protected
> 
> OK, I'll make that change (along with the change to the implementation 
> of "FileSink::afterGettingFrame()" - noted earlier) in the next 
> release of the software.

Thank you.



-- 
Living Data - Sistemas de Informação e Apoio à Decisão, Lda.

LxFactory - Rua Rodrigues de Faria, 103,
edifício I - 4º piso                  Phone:  +351 213622163
1300-501 LISBOA                       Fax:    +351 213622165
Portugal                              URL: www.livingdata.pt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: StreamReplicator-patched.cpp
Type: text/x-c++src
Size: 16684 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130122/10f4fd00/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testReplicator-modified.cpp
Type: text/x-c++src
Size: 6758 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130122/10f4fd00/attachment-0003.bin>


More information about the live-devel mailing list