[Live-devel] Pls give suggestion about the testReplicator.cpp

Ross Finlayson finlayson at live555.com
Tue Jul 10 05:13:53 PDT 2012


The basic problem is your code's use of the port number 8556.  First, you shouldn't think of it as being the server's 'output' port.  Instead, it's the 'control' port that the server uses for incoming RTSP connections from clients.  (The actual RTP/RTCP stream 'output' uses other port numbers, which will differ for each client.)

Anyway, the key point is that because the server uses port number 8556 for RTSP, your code can't reuse it.

Also, you should not be calling "getStreamParameters()" and "getStreamSource()" at all.  Those functions are only used internally by our library code to implement RTSP server functionality; you should not be calling them yourself in your code.

Because your server is receiving Transport Stream packets on a UDP port (1236, in your case), and then re-serving this data via RTSP, you should just be using a variant of the code that's used (in lines 330-356 of "testProgs/testOnDemandRTSPServer.cpp") to demonstrate this functionality in the "testOnDemandRTSPServer" demo application.

The change that you would make is that instead of using the "MPEG2TransportUDPServerMediaSubsession" class, you would use a *subclass* of this - that you would write.  For the purposes of this email, let's call this subclass "modifiedMPEG2TransportUDPServerMediaSubsession".

Your "modifiedMPEG2TransportUDPServerMediaSubsession" class would be a subclass of "MPEG2TransportUDPServerMediaSubsession", and would reimplement just one virtual function: "createNewStreamSource()".  Your reimplemented "createNewStreamSource()" function would look something like this:


FramedSource* modifiedMPEG2TransportUDPServerMediaSubsession
::createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate) {
	FramedSource* inputSource = MPEG2TransportUDPServerMediaSubsession:: createNewStreamSource(clientSessionId, estBitrate);
		// call the parent class's implementation first

	StreamReplicator* replicator = StreamReplicator::createNew(envir(), inputSource);

	startReplicaFileSink(replicator, "test.ts");
	startReplicaFileSink(replicator, "test2.ts");

	return replicator->createStreamReplica();
}


I.e., your code would replace the input source stream with a replica, while creating two more replicas for use in output files.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120710/5c1ad8d3/attachment.html>


More information about the live-devel mailing list