[Live-devel] Proxying SIP live RTP to RTSP problem (segfault)

rus at sfinx.in rus at sfinx.in
Sun Sep 24 21:34:15 PDT 2017


Hi,

> The key to understanding your problem is this line:
> > "FramedSource[0x2493050]::getNextFrame(): attempting to read more than once at the same time!?
> What?s happening (according to the stack trace) is that the ?FramedSource? object that?s being fed into the ?H264VideoStreamDiscreteFramer? object is being read from more than once at the same time.  In this case, this is the ?MediaSubsession?s ?readSource()?.
> You?re problem is that you?re setting up a RTSP server to read from the incoming H.264 video stream (from SIP), but you?re still writing that same incoming H.264 video stream into a file.  Therefore, two different objects are trying to read from the same ?FramedSource? object at the same time, which is a no no.
> You have two solutions:
> 1/ Stop writing the video stream to a file.  The easiest way to do this is to run your (modified) ?playSIP? application with the ?-r? command-line flag.

Well, running playSIP with -r flag gives just the another SIGSEGV without any error messages:

...
#0  0x000000000044bbf3 in FramedSource::getNextFrame (this=0x0, to=0x18899e1 "", maxSize=2000000,     afterGettingFunc=0x4511ba <H264or5VideoStreamDiscreteFramer::afterGettingFrame(void*, unsigned int, unsigned int, timeval, unsigned int)>, afterGettingClientData=0x169f2d0,     onCloseFunc=0x44bd64 <FramedSource::handleClosure(void*)>, onCloseClientData=0x169f2d0)    at FramedSource.cpp:63
63	  if (fIsCurrentlyAwaitingData) {
(gdb) backtrace
#0  0x000000000044bbf3 in FramedSource::getNextFrame (this=0x0, to=0x18899e1 "", maxSize=2000000,     afterGettingFunc=0x4511ba <H264or5VideoStreamDiscreteFramer::afterGettingFrame(void*, unsigned int, unsigned int, timeval, unsigned int)>, afterGettingClientData=0x169f2d0,     onCloseFunc=0x44bd64 <FramedSource::handleClosure(void*)>, onCloseClientData=0x169f2d0)    at FramedSource.cpp:63
#1  0x00000000004511b3 in H264or5VideoStreamDiscreteFramer::doGetNextFrame (this=0x169f2d0)    at H264or5VideoStreamDiscreteFramer.cpp:40
#2  0x000000000044bcea in FramedSource::getNextFrame (this=0x169f2d0, to=0x18899e1 "", maxSize=2000000,     afterGettingFunc=0x45fa1a <H264or5Fragmenter::afterGettingFrame(void*, unsigned int, unsigned int, timeval, unsigned int)>, afterGettingClientData=0x16a00e0,     onCloseFunc=0x44bd64 <FramedSource::handleClosure(void*)>, onCloseClientData=0x16a00e0)    at FramedSource.cpp:78
#3  0x000000000045f552 in H264or5Fragmenter::doGetNextFrame (this=0x16a00e0)    at H264or5VideoRTPSink.cpp:181
#4  0x000000000044bcea in FramedSource::getNextFrame (this=0x16a00e0, to=0x16a07bc "", maxSize=2000532,     afterGettingFunc=0x41488a <MultiFramedRTPSink::afterGettingFrame(void*, unsigned int, unsigned int, timeval, unsigned int)>, afterGettingClientData=0x169f890,     onCloseFunc=0x415274 <MultiFramedRTPSink::ourHandleClosure(void*)>, onCloseClientData=0x169f890)    at FramedSource.cpp:78
#5  0x0000000000414869 in MultiFramedRTPSink::packFrame (this=0x169f890) at MultiFramedRTPSink.cpp:224
#6  0x00000000004146b6 in MultiFramedRTPSink::buildAndSendPacket (this=0x169f890,     isFirstPacket=1 '\001') at MultiFramedRTPSink.cpp:199
#7  0x00000000004144f5 in MultiFramedRTPSink::continuePlaying (this=0x169f890)    at MultiFramedRTPSink.cpp:159
#8  0x000000000045f272 in H264or5VideoRTPSink::continuePlaying (this=0x169f890)    at H264or5VideoRTPSink.cpp:127
#9  0x000000000040c08a in MediaSink::startPlaying (this=0x169f890, source=...,     afterFunc=0x4393f9 <afterPlayingStreamState(void*)>, afterClientData=0x169f670) at MediaSink.cpp:78
#10 0x00000000004398f0 in StreamState::startPlaying (this=0x169f670, dests=0x169f480,
....

What is the reason of this particular SIGSEGV ? How to fix it ?

> I should also point out, however, that there?s a much much easier way to feed the video output from ?playSIP? into a RTSP server: Run them as separate applications, and pipe the H.264 video between them.  I.e., run (on the command line):
> 	playSIP -v etc | your-modified-testOnDemandRTSPServer
> where "your-modified-testOnDemandRTSPServer? is a slightly modified version of the ?testOnDemandRTSPServer? demo application that:
> 	1/ Sets ?reuseFirstSource? to True (?testOnDemandRTSPServer.cpp?, line 29)
> 	2/ Changes ?test.264? to ?stdin? (?testOnDemandRTSPServer.cpp?, line 99)
> 	See also http://live555.com/liveMedia/faq.html#liveInput-unicast

 Though passing the data through stdin is ugly solution - this is the
first thing I've tried, but it do not works too. The main issue as I see
is that playSIP outputs the buggy (just two 00000001) raw h264 if the
sprop-parameter-sets is not presenet in SDP but the testOnDemandRTSPServer
always expects byte-stream h264 format. The SIP servers ususally do
not / never supply the sprop-parameter-sets but the profile-level-id
fmtp entry only.

Is there a way to fix this and make at least stdin approach to work with SIP ?

TIA, Rus

>
>
> 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
>


More information about the live-devel mailing list