Yuan, Chao (Chao)** CTR ** | 10 Jul 2012 08:26
Favicon

Pls give suggestion about the testReplicator.cpp

All,
I used the live555 lib to make a simple RTSP server, my server IP is 135.240.130.30, the inputPort is 1236, the outputPort is 8556,
One phone can send TS packet to 1236 port, another phone can get the packets from rtsp://135.240.130.30:8556/mobileLiveVideo,
This works fine.
 
However, I also want to store/save this TS stream source on the live555 server into a stream file,for example(test.ts), after I see the code in testProgs/testReplicator.cpp, I add some code to do this:
 
unsigned fOurSessionId;
  Port clientRTPPort(0), clientRTCPPort(0), serverRTPPort(0), serverRTCPPort(0);
  netAddressBits destinationAddress = 0;
  u_int8_t destinationTTL = 0;
  Boolean isMulticast = False;
  void* streamToken;
  subsess->getStreamParameters(fOurSessionId, 0, clientRTPPort,clientRTCPPort, 0,0,0, destinationAddress,destinationTTL,
  isMulticast, serverRTPPort,serverRTCPPort, streamToken);
 
// get the source        
  FramedSource* source = subsess->getStreamSource(streamToken);
  StreamReplicator* replicator = StreamReplicator::createNew(*env, source);
 
  // Then create a network (UDP) 'sink' object to receive a replica of the input stream, and start it.
  // If you wish, you can duplicate this line - with different network addresses and ports - to create multiple output UDP streams:
  startReplicaUDPSink(replicator,"135.240.130.30",8556);
 
  // Then create a file 'sink' object to receive a replica of the input stream, and start it.
  // If you wish, you can duplicate this line - with a different file name - to create multiple output files:
  startReplicaFileSink(replicator, "test.ts");
  startReplicaFileSink(replicator, "test2.ts");
  *env<<"\nstartReplicaFileSink\n";
 
 
The startReplicaUDPSink and startReplicaFileSink is same as in testProgs/testReplicator.cpp.
The problem is the test.ts and test2.ts can save the TS packet correctly, but the phone can not get packets from rtsp://135.240.130.30:8556/mobileLiveVideo,
And an error on my server occurred:
FramedSource[0x1fea260]::getNextFrame(): attempting to read more than once at the same time!
Aborted
 
Can anyone tell we what’s wrong? Thank you.
 
BR,
Chao,Yuan
 
_______________________________________________
live-devel mailing list
live-devel@...
http://lists.live555.com/mailman/listinfo/live-devel
Ross Finlayson | 10 Jul 2012 14:13
Favicon

Re: 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/

_______________________________________________
live-devel mailing list
live-devel@...
http://lists.live555.com/mailman/listinfo/live-devel
Yuan, Chao (Chao)** CTR ** | 12 Jul 2012 11:17
Favicon

Re: Pls give suggestion about the testReplicator.cpp

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-m22LxytlYjp4ccXRSk2lxg@public.gmane.org [mailto:live-devel-bounces-m22LxytlYjp4ccXRSk2lxg@public.gmane.org] 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/

 

_______________________________________________
live-devel mailing list
live-devel@...
http://lists.live555.com/mailman/listinfo/live-devel
Yuan, Chao (Chao)** CTR ** | 12 Jul 2012 11:17
Favicon

Re: Pls give suggestion about the testReplicator.cpp

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/

 

_______________________________________________
live-devel mailing list
live-devel <at> lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel
Yuan, Chao (Chao)** CTR ** | 12 Jul 2012 11:31
Favicon

Re: Pls give suggestion about the testReplicator.cpp

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-m22LxytlYjp4ccXRSk2lxg@public.gmane.org [mailto:live-devel-bounces-m22LxytlYjp4ccXRSk2lxg@public.gmane.org] 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/

 

_______________________________________________
live-devel mailing list
live-devel@...
http://lists.live555.com/mailman/listinfo/live-devel
Ross Finlayson | 12 Jul 2012 11:46
Favicon

Re: Pls give suggestion about the testReplicator.cpp

What should I do?

For starters, DO NOT post the same question to the mailing list more than once.  Also, please trim your messages (so that you're not quoting the entire message that you're responding to).  This is basic email 'netiquette'.

I didn't really understand your question, but it sounds like you want to demultiplex Transport Stream data into its constituent video and audio elementary streams.  Unfortunately, we don't provide any Transport Stream demultiplexing code, so this is something that you would need to write yourself.


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

_______________________________________________
live-devel mailing list
live-devel@...
http://lists.live555.com/mailman/listinfo/live-devel
Ross Finlayson | 12 Jul 2012 11:46
Favicon

Re: Pls give suggestion about the testReplicator.cpp

What should I do?

For starters, DO NOT post the same question to the mailing list more than once.  Also, please trim your messages (so that you're not quoting the entire message that you're responding to).  This is basic email 'netiquette'.

I didn't really understand your question, but it sounds like you want to demultiplex Transport Stream data into its constituent video and audio elementary streams.  Unfortunately, we don't provide any Transport Stream demultiplexing code, so this is something that you would need to write yourself.


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

_______________________________________________
live-devel mailing list
live-devel <at> lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel
Yuan, Chao (Chao)** CTR ** | 12 Jul 2012 11:31
Favicon

Re: Pls give suggestion about the testReplicator.cpp

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/

 

_______________________________________________
live-devel mailing list
live-devel <at> lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel
Ross Finlayson | 10 Jul 2012 14:13
Favicon

Re: 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/

_______________________________________________
live-devel mailing list
live-devel <at> lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Gmane