[Live-devel] Media stream duplication on a streaming relay

Ross Finlayson finlayson at live555.com
Thu Dec 8 10:57:31 PST 2005


As you noticed, you can't duplicate a stream by having each recipient 
read from a single object, because "getNextFrame()" can't be called 
more than once on the same object concurrently.

The solution, instead, is to create a separate object (of some 
"FramedSource" subclass) for each recipient.  This new class would 
implement the "doGetNextFrame()" virtual function by somehow 
'registering' with the data source object - to request a copy of the 
next incoming frame.

The data source object (which would *not* be a subclass of 
"FramedSource", and so would not implement "doGetNextFrame()") would 
handle these requests by delivering copies of each incoming frame to 
each recipient, and not ask for a new incoming frame (from its 
upstream data source) until it has finished delivering data to each 
downstream recipient.

For an example of code that is similar to this, note the relationship 
between the "MPEG1or2Demux" and "MPEG1or2DemuxedElementaryStream" 
classes.  (In this case, however, we are demultiplexing data to 
downstream recipients, rather than duplicating it.)  Note in 
particular that (i) "MPEG1or2Demux" is subclassed from "Medium", not 
"FramedSource", and (ii) "MPEG1or2Demux" implements a 
"getNextFrame()" function that is similar to, but different from 
"FramedSource::getNextFrame()".

(This functionality (data duplication) is something that should 
probably be added to the library someday.  Until then, however, you 
will need to implement it yourself.)


	Ross Finlayson
	Live Networks, Inc. (LIVE555.COM)
	<http://www.live555.com/>



More information about the live-devel mailing list