[Live-devel] saving incoming RTP A/V stream as MPEG-2 transport stream

Markus Schumann markuss at sonicfoundry.com
Wed Apr 17 15:55:57 PDT 2013


One more thing - I end up with a stack overflow:

                SfLive555Client.dll!FileSink::afterGettingFrame(void * clientData, unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime, unsigned int __formal)  Line 88 + 0x1f bytes      C++
               SfLive555Client.dll!FramedSource::afterGetting(FramedSource * source)  Line 91 + 0x31 bytes  C++
               SfLive555Client.dll!MPEG2TransportStreamMultiplexor::doGetNextFrame()  Line 83 + 0x9 bytes               C++
               SfLive555Client.dll!FramedSource::getNextFrame(unsigned char * to, unsigned int maxSize, void (void *, unsigned int, unsigned int, timeval, unsigned int)* afterGettingFunc, void * afterGettingClientData, void (void *)* onCloseFunc, void * onCloseClientData)  Line 78 + 0xf bytes              C++
               SfLive555Client.dll!FileSink::continuePlaying()  Line 80    C++
               SfLive555Client.dll!FileSink::afterGettingFrame(unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime)  Line 141 + 0xf bytes                C++
               SfLive555Client.dll!FileSink::afterGettingFrame(void * clientData, unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime, unsigned int __formal)  Line 88 + 0x1f bytes      C++
               SfLive555Client.dll!FramedSource::afterGetting(FramedSource * source)  Line 91 + 0x31 bytes  C++
               SfLive555Client.dll!MPEG2TransportStreamMultiplexor::doGetNextFrame()  Line 83 + 0x9 bytes               C++
               SfLive555Client.dll!FramedSource::getNextFrame(unsigned char * to, unsigned int maxSize, void (void *, unsigned int, unsigned int, timeval, unsigned int)* afterGettingFunc, void * afterGettingClientData, void (void *)* onCloseFunc, void * onCloseClientData)  Line 78 + 0xf bytes              C++
               SfLive555Client.dll!FileSink::continuePlaying()  Line 80    C++
               SfLive555Client.dll!FileSink::afterGettingFrame(unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime)  Line 141 + 0xf bytes                C++
               SfLive555Client.dll!FileSink::afterGettingFrame(void * clientData, unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime, unsigned int __formal)  Line 88 + 0x1f bytes      C++
               SfLive555Client.dll!FramedSource::afterGetting(FramedSource * source)  Line 91 + 0x31 bytes  C++
               SfLive555Client.dll!MPEG2TransportStreamMultiplexor::doGetNextFrame()  Line 83 + 0x9 bytes               C++
               SfLive555Client.dll!FramedSource::getNextFrame(unsigned char * to, unsigned int maxSize, void (void *, unsigned int, unsigned int, timeval, unsigned int)* afterGettingFunc, void * afterGettingClientData, void (void *)* onCloseFunc, void * onCloseClientData)  Line 78 + 0xf bytes              C++
               SfLive555Client.dll!FileSink::continuePlaying()  Line 80    C++
               SfLive555Client.dll!FileSink::afterGettingFrame(unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime)  Line 141 + 0xf bytes                C++
               SfLive555Client.dll!FileSink::afterGettingFrame(void * clientData, unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime, unsigned int __formal)  Line 88 + 0x1f bytes      C++
               SfLive555Client.dll!FramedSource::afterGetting(FramedSource * source)  Line 91 + 0x31 bytes  C++
               SfLive555Client.dll!MPEG2TransportStreamMultiplexor::doGetNextFrame()  Line 83 + 0x9 bytes               C++
               SfLive555Client.dll!FramedSource::getNextFrame(unsigned char * to, unsigned int maxSize, void (void *, unsigned int, unsigned int, timeval, unsigned int)* afterGettingFunc, void * afterGettingClientData, void (void *)* onCloseFunc, void * onCloseClientData)  Line 78 + 0xf bytes              C++
               SfLive555Client.dll!FileSink::continuePlaying()  Line 80    C++
               SfLive555Client.dll!FileSink::afterGettingFrame(unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime)  Line 141 + 0xf bytes                C++
               SfLive555Client.dll!FileSink::afterGettingFrame(void * clientData, unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime, unsigned int __formal)  Line 88 + 0x1f bytes      C++
               SfLive555Client.dll!FramedSource::afterGetting(FramedSource * source)  Line 91 + 0x31 bytes  C++
               SfLive555Client.dll!MPEG2TransportStreamMultiplexor::doGetNextFrame()  Line 83 + 0x9 bytes               C++
               SfLive555Client.dll!MPEG2TransportStreamMultiplexor::handleNewBuffer(unsigned char * buffer, unsigned int bufferSize, int mpegVersion, MPEG1or2Demux::SCR scr)  Line 135 + 0xf bytes    C++
               SfLive555Client.dll!InputESSourceRecord::deliverBufferToClient()  Line 222          C++
               SfLive555Client.dll!MPEG2TransportStreamFromESSource::awaitNewBuffer(unsigned char * oldBuffer)  Line 133 + 0x8 bytes             C++
               SfLive555Client.dll!InputESSourceRecord::afterGettingFrame1(unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime)  Line 259 + 0x19 bytes  C++
               SfLive555Client.dll!InputESSourceRecord::afterGettingFrame(void * clientData, unsigned int frameSize, unsigned int numTruncatedBytes, timeval presentationTime, unsigned int __formal)  Line 232       C++
               SfLive555Client.dll!FramedSource::afterGetting(FramedSource * source)  Line 91 + 0x31 bytes  C++
               SfLive555Client.dll!MultiFramedRTPSource::doGetNextFrame1()  Line 198 + 0x9 bytes   C++
               SfLive555Client.dll!MultiFramedRTPSource::networkReadHandler1()  Line 325   C++
               SfLive555Client.dll!MultiFramedRTPSource::networkReadHandler(MultiFramedRTPSource * source, int __formal)  Line 222                C++
               SfLive555Client.dll!BasicTaskScheduler::SingleStep(unsigned int maxDelayTime)  Line 163 + 0x1e bytes  C++
               SfLive555Client.dll!BasicTaskScheduler0::doEventLoop(char * watchVariable)  Line 80 + 0x11 bytes          C++
               SfLive555Client.dll!RecordingClient::Run()  Line 187 + 0x33 bytes               C++

From: live-devel-bounces at ns.live555.com [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Markus Schumann
Sent: Wednesday, April 17, 2013 4:55 PM
To: LIVE555 Streaming Media - development & use
Subject: [Live-devel] saving incoming RTP A/V stream as MPEG-2 transport stream

Ross,

Thanks for your initial answer!

I am still trying to save an incoming RTP AVC/AAC stream inside a MPEG-2 transport stream.

I followed the flow of your testRTSPClient.cpp example which worked perfectly for my first application.


I created a MPEG2TransportStreamFromESSource, FileSink and MediaSession.


pRTSPClient->m_pMPEG2TransportStreamFromESSource = MPEG2TransportStreamFromESSource::createNew(env);

pRTSPClient->m_pFileSink = FileSink::createNew(env,pRTSPClient->m_sOutputFilename.c_str());



scs.m_pMediaSession = MediaSession::createNew(env, sdpDescription);



For each MediaSubsession

I am always getting AVC/AAC - hence 5 & 4 as MPEG type

for each sub session I do:

     if( strcmp(scs.m_pMediaSubsession->mediumName(),"video") == 0)
      {
         pRTSPClient->m_pMPEG2TransportStreamFromESSource->addNewVideoSource(scs.m_pMediaSubsession->readSource(),5);
      }
      if( strcmp(scs.m_pMediaSubsession->mediumName(),"audio") == 0)
      {
         pRTSPClient->m_pMPEG2TransportStreamFromESSource->addNewAudioSource(scs.m_pMediaSubsession->readSource(),4);
      }
      else
      {
         // error
      }

Do I set scs.m_pMediaSubsession->sink?

Do I call scs.m_pMediaSubsession->sink->startPlaying( *(scs.m_pMediaSubsession->readSource()),
                                                    RecordingSubsessionAfterPlaying,
                                                    scs.m_pMediaSubsession);



How Do I feed a MPEG2TransportStreamFromESSource into the file sink?

I only found pRTSPClient->m_pFileSink->startPlaying(   *pRTSPClient->m_pMPEG2TransportStreamFromESSource,
                                             NULL,
                                             NULL);



Thanks
Markus




From: live-devel-bounces at ns.live555.com<mailto:live-devel-bounces at ns.live555.com> [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Ross Finlayson
Sent: Saturday, April 13, 2013 2:08 PM
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] saving or rebroadcasting incoming RTP A/V stream as MPEG-2 transport stream

I saw various source files (e.g. MPEG2TransportStreamMultiplexor.cpp) muxing into MPEG-2 TS.
Is there a way a save and/or rebroadcast incoming RTP streams as MPEG-2 TS with the given code.

Yes, provided, of course, that the codec(s) used by the incoming RTP stream(s) are ones that can be carried within MPEG Transport Streams.

You can do this by creating a "MPEG2TransportStreamFromESSource" object.  Then, on this object, call "addNewVideoSource()" and/or "addNewAudioSource()", from the corresponding "MediaSubsession::readSource()".  You can then feed the "MPEG2TransportStreamFromESSource" object into a "FileSink".

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/20130417/926afc7c/attachment-0001.html>


More information about the live-devel mailing list