Hi got some strange behavior when I try to stream H.264 .<br><br>I have my implementation of device source class, which directly read entire frames from <br>a socket, and feed the H264VideoSink. I have already made a similar class for MPEG1 ,<br>
and it was working fine...<br><br>Here the afterGettingframe of the H264FUAFragmenter misbehave such that when there is the call<br>to doNextFrame at the end of the function.. it points nowhere and it crashes...I have noticed there are always<br>
2 similar executions with both the real source and the fragmenter objects after the call to afterGetting(this) in device source<br><br>PS: this happens since the first call<br><br>Here is a trace with gdb :<br><br><br>Breakpoint 1, H264VideoRTPSink::continuePlaying (this=0x8926578) at H264VideoRTPSink.cpp:74<br>
74 if (fOurFragmenter == NULL) {<br>(gdb) n<br>59 UsageEnvironment& envir() const {return fEnviron;}<br>(gdb) <br>76 ourMaxPacketSize() - 12/*RTP hdr size*/);<br>(gdb) <br>59 UsageEnvironment& envir() const {return fEnviron;}<br>
(gdb) <br>76 ourMaxPacketSize() - 12/*RTP hdr size*/);<br>(gdb) <br>77 fSource = fOurFragmenter;<br><span style="background-color: rgb(255, 255, 51);">(gdb) print fOurFragmenter</span><br style="background-color: rgb(255, 255, 51);">
<span style="background-color: rgb(255, 255, 51);">$1 = (H264FUAFragmenter *) 0x893b6d8</span> // this is the address of the fragmenter constructed...<br>(gdb) n<br>81 return MultiFramedRTPSink::continuePlaying();<br>
(gdb) c<br>Continuing.<br>packet 0 of size 12<br>DATA::: received: 3744, expected: 3744<br><br>Breakpoint 2, DeviceSource::<span style="background-color: rgb(153, 153, 255);">deliverFrame (this=0x89355c8)</span> at DeviceSource.cpp:201 //this is the address Device object<br>
201 void DeviceSource::deliverFrame() {<br>(gdb) n<br>203 if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet<br>(gdb) <br>205 if(Ntrashed != 0){<br>(gdb) <br>210 fFrameSize = Nreceived;<br>
(gdb) <br>218 gettimeofday(&fPresentationTime, NULL);<br>(gdb) <br>52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));<br>(gdb) <br>220 fDurationInMicroseconds = DeviceSource::defaultFrameDuration;<br>
(gdb) <br>52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));<br>(gdb) <br>224 FramedSource::afterGetting(this);<br>(gdb) s<br>226 }<br>(gdb) <br><span style="background-color: rgb(255, 255, 102);">DeviceSource::deliverFrame (this=0x893b6d8</span>) at DeviceSource.cpp:224 //???<br>
224 FramedSource::afterGetting(this);<br>(gdb) <br><span style="background-color: rgb(153, 153, 255);">FramedSource::afterGetting (source=0x89355c8)</span> at FramedSource.cpp:81 //<span style="background-color: rgb(255, 255, 102);"></span>now we have the right address again<br>
81 void FramedSource::afterGetting(FramedSource* source) {<br>(gdb) <br>87 if (source->fAfterGettingFunc != NULL) {<br>(gdb) <br>82 source->fIsCurrentlyAwaitingData = False;<br>(gdb) <br>87 if (source->fAfterGettingFunc != NULL) {<br>
(gdb) <br>91 source->fDurationInMicroseconds);<br>(gdb) <br>H264FUAFragmenter::afterGettingFrame (<span style="background-color: rgb(255, 255, 51);">clientData=0x893b6d8,</span> frameSize=3744, numTruncatedBytes=0, presentationTime=<br>
{tv_sec = 1249394529, tv_usec = 926474}, durationInMicroseconds=40) at H264VideoRTPSink.cpp:226<br>226 }<br>(gdb) <br>H264FUAFragmenter::afterGettingFrame <span style="background-color: rgb(153, 153, 255);">(clientData=0x89355c8</span>, frameSize=143898457, numTruncatedBytes=60000, <br>
presentationTime={tv_sec = 134630672, tv_usec = 143898328}, durationInMicroseconds=134523216)<br> at H264VideoRTPSink.cpp:225<br>225 durationInMicroseconds); //the parameters seems to be garbage to<span style="background-color: rgb(153, 153, 255);"></span> me..<br>
(gdb) <br>H264FUAFragmenter::afterGettingFrame1 (this=0x893b6d8, frameSize=3744, numTruncatedBytes=0, presentationTime=<br> {tv_sec = 1249394529, tv_usec = 926474}, durationInMicroseconds=40) at H264VideoRTPSink.cpp:231<br>
231 unsigned durationInMicroseconds) {<br>(gdb) <br>232 fNumValidDataBytes += frameSize;<br>(gdb) <br>233 fSaveNumTruncatedBytes = numTruncatedBytes;<br>(gdb) <br>234 fPresentationTime = presentationTime;<br>
(gdb) <br>235 fDurationInMicroseconds = durationInMicroseconds;<br>(gdb) <br>238 <span style="background-color: rgb(153, 153, 255);"> doGetNextFrame();</span><br>(gdb) <br>239 }<br>(gdb) <br>H264FUAFragmenter::afterGettingFrame1 (this=0x89355c8, frameSize=143898457, numTruncatedBytes=60000, <br>
presentationTime={tv_sec = 134630672, tv_usec = 143898328}, durationInMicroseconds=134523216)<br> at H264VideoRTPSink.cpp:238<br>238 doGetNextFrame();<br>(gdb) <br><br>Program received signal SIGSEGV, Segmentation fault.<br>
H264FUAFragmenter::afterGettingFrame1 (this=0x89355c8, frameSize=143898457, numTruncatedBytes=60000, <br> presentationTime={tv_sec = 134630672, tv_usec = 143898328}, durationInMicroseconds=134523216)<br> at H264VideoRTPSink.cpp:238<br>
238 doGetNextFrame();<br>(gdb) where<br>#0 H264FUAFragmenter::afterGettingFrame1 (this=0x89355c8, frameSize=143898457, numTruncatedBytes=60000, <br> presentationTime={tv_sec = 134630672, tv_usec = 143898328}, durationInMicroseconds=134523216)<br>
at H264VideoRTPSink.cpp:238<br>#1 0x08064eef in H264FUAFragmenter::doGetNextFrame (this=0x89355c8) at H264VideoRTPSink.cpp:150<br>#2 0x0806e06d in MultiFramedRTPSink::packFrame (this=0x8926578) at MultiFramedRTPSink.cpp:215<br>
#3 0x0806e589 in MultiFramedRTPSink::continuePlaying (this=0x8926578) at MultiFramedRTPSink.cpp:151<br>#4 0x08049e4c in play () at H264RTPSender.cpp:97<br>#5 0x08049fee in main () at H264RTPSender.cpp:68<br><br>