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

Yuan, Chao (Chao)** CTR ** chao.yuan at alcatel-lucent.com
Thu Jul 12 02:31:36 PDT 2012


Hi,
Thank you very much, I did as you say, and now it works fine: the ts packets can save as local file.
If  I want to save ts packets to a seial of files:
For example, when I found a I frame (h264 encoded, we only have I frame and P frame), I save the next packets to a file: 1.ts, when I found a next I frame,I save next packets to 2.ts,....
I tried:
MediaSink* sink = FileSink::createNew(envir(), outputFileName, 20000,true);
but the saved each  files are 1316B , because the source send packets are 188*7.
What should I do?

BR,
Chao, Yuan


________________________________
From: live-devel-bounces at ns.live555.com [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Ross Finlayson
Sent: Tuesday, July 10, 2012 8:14 PM
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] Pls give suggestion about the testReplicator.cpp

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/20120712/468ac7e4/attachment.html>


More information about the live-devel mailing list