[Live-devel] How to Pause a medium

hornsby adrian_hornsby at yahoo.co.uk
Wed Oct 19 16:41:23 PDT 2005


Hi Ross,
I have been trying all of your advices bellow put my CPU consumption is still 
around 90% !!
I have implemented my own subclass of FramedSource (based on 
MPEG2TransportStreamFramer but with 2 input)  but when I call  
"FramedSource::stopGettingFrames()" that doesn't have any effect.
The CPU seems to be in an endless loop or something.

here is what I do:

In my MPEG2TransportStreamSplicer.cpp (based on 
MPEG2TransportStreamFramer.cpp) :

//###################################################//
void MPEG2TransportStreamSplicer::doStopGettingFrames() {
if( pSpliceStatus->ActiveInput==1){
  fInputSource2->stopGettingFrames();
  }
if( pSpliceStatus->ActiveInput==2){
  fInputSource1->stopGettingFrames();
  }
}


then in your FramedSource :
//######################################################//
void FramedSource::stopGettingFrames() {
  fIsCurrentlyAwaitingData = False; // indicates that we can be read again

  // Perform any specialized action now:
  doStopGettingFrames();
}

void FramedSource::doStopGettingFrames() {
  // Default implementation: Do nothing
  // Subclasses may wish to specialize this so as to ensure that a
  // subsequent reader can pick up where this one left off.
}
//#######################################################//


I can I stop one stream without deleting it. 
That is the only problem I have a the moment that prevent a release of the 
program, so I'm really frustrated because I feel like missing a point 
somewhere.

Thanks you so much for all the help you already provided.

adrian


On Tuesday 18 October 2005 14:32, Ross Finlayson wrote:
> >Is it possible to pause a medium as it is possible the
> >stop it by Medium::close(fInputSource1); ??
>
> Yes, call "FramedSource::stopGettingFrames()" (or, on a 'sink'
> object: "MediaSink::stopPlaying()" (which calls
> "FramedSource::stopGettingFrames()")).
>
> Note that if you are implementing your own source object, you will
> need to implement the virtual function
> "FramedSource::doStopGettingFrames()".
>
> >I have 2 MPEG2_TS framed source streams opened and I
> >only output one at a time, and CPU consumption goes
> >wild. So when I dont ouput a stream, I want to pause
> >it, so CPU doesnt go crasy. Any easy way ??
>
> See above.  (However, if your CPU is "going wild", then you should
> make sure that your source object implementation is not doing some
> dumb polling.)
>
>
> 	Ross Finlayson
> 	Live Networks, Inc. (LIVE555.COM)
> 	<http://www.live555.com/>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel

	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


More information about the live-devel mailing list