On Tue, Jan 14, 2014 at 10:23 AM, Pak Man Chan <parkchan1...@gmail.com>wrote:
> On Mon, Jan 13, 2014 at 8:27 AM, Ross Finlayson <finlay...@live555.com>wrote: > >> In TCPStreamSink::processBuffer, onSourceClosure is being called >> twice, one being called inside the fSource->getNextFrame call, and the >> other being called when the source is done. >> >> >> No, the function that's being called (as a 'input source closure' >> handler) as a result of "getNextFrame()" is >> "TCPStreamSink::ourOnSourceClosure()" (note the "our" in the name). It's a >> different function from the "onSourceClosure()" function that's called >> later. >> >> >> This is a stack trace on hitting MediaSink::onSourceClosure(), > "getNextFrame()" will indeed call onSourceClosure through > "TCPStreamSink::ourOnSourceClosure()". > > #0 MediaSink::onSourceClosure (this=0x6b0a20) at MediaSink.cpp:99 > #1 0x0000000000449d4a in TCPStreamSink::processBuffer (this=0x6b0a20) > at TCPStreamSink.cpp:75 > #2 0x0000000000449ed5 in TCPStreamSink::ourOnSourceClosure1 > (this=0x6b0a20) > at TCPStreamSink.cpp:115 > #3 0x0000000000449eb0 in TCPStreamSink::ourOnSourceClosure > (clientData=0x6b0a20) > at TCPStreamSink.cpp:109 > #4 0x000000000042ab52 in FramedSource::handleClosure (clientData=0x6af750) > at FramedSource.cpp:99 > #5 0x000000000044145d in MPEG2TransportStreamFramer::doGetNextFrame > (this=0x6af750) > at MPEG2TransportStreamFramer.cpp:107 > #6 0x000000000042aaaa in FramedSource::getNextFrame (this=0x6af750, > to=0x6b0a70 "G\001", maxSize=10000, > afterGettingFunc=0x449dc6 <TCPStreamSink::afterGettingFrame(void*, > unsigned int, unsigned int, timeval, unsigned int)>, > afterGettingClientData=0x6b0a20, > onCloseFunc=0x449e90 <TCPStreamSink::ourOnSourceClosure(void*)>, > onCloseClientData=0x6b0a20) at FramedSource.cpp:78 > #7 0x0000000000449d0f in TCPStreamSink::processBuffer (this=0x6b0a20) > at TCPStreamSink.cpp:70 > #8 0x0000000000449e8d in TCPStreamSink::afterGettingFrame (this=0x6b0a20, > frameSize=1128, numTruncatedBytes=0) at TCPStreamSink.cpp:104 > #9 0x0000000000449e06 in TCPStreamSink::afterGettingFrame > (clientData=0x6b0a20, > frameSize=1128, numTruncatedBytes=0) at TCPStreamSink.cpp:94 > #10 0x000000000042ab0b in FramedSource::afterGetting (source=0x6af750) > at FramedSource.cpp:91 > #11 0x00000000004417e8 in MPEG2TransportStreamFramer::afterGettingFrame1 ( > this=0x6af750, frameSize=1128, presentationTime=...) > at MPEG2TransportStreamFramer.cpp:192 > #12 0x0000000000441567 in MPEG2TransportStreamFramer::afterGettingFrame ( > clientData=0x6af750, frameSize=1128, presentationTime=...) > at MPEG2TransportStreamFramer.cpp:136 > #13 0x000000000042ab0b in FramedSource::afterGetting (source=0x6af660) > at FramedSource.cpp:91 > #14 0x000000000042b5f6 in ByteStreamFileSource::doReadFromFile > (this=0x6af660) > at ByteStreamFileSource.cpp:179 > #15 0x000000000042b38f in ByteStreamFileSource::fileReadableHandler > (source=0x6af660) > at ByteStreamFileSource.cpp:123 > #16 0x000000000046ad90 in BasicTaskScheduler::SingleStep (this=0x6a8010, > maxDelayTime=0) at BasicTaskScheduler.cpp:163 > #17 0x000000000046d4aa in BasicTaskScheduler0::doEventLoop (this=0x6a8010, > watchVariable=0x0) at BasicTaskScheduler0.cpp:80 > #18 0x0000000000402556 in main (argc=1, argv=0x7fffffffe4a8) > at live555MediaServer.cpp:88 > > after this, MediaSink::onSourceClosure() will be called again > on TCPStreamSink.cpp:75. > > Following is the stack trace when the crash happens. > > Program received signal SIGSEGV, Segmentation fault. > 0x0000000000000000 in ?? () > (gdb) bt > #0 0x0000000000000000 in ?? () > #1 0x0000000000403c33 in MediaSink::onSourceClosure (this=0x6b5850) > at MediaSink.cpp:99 > #2 0x0000000000449d4a in TCPStreamSink::processBuffer (this=0x6b5850) > at TCPStreamSink.cpp:75 > #3 0x0000000000449e8d in TCPStreamSink::afterGettingFrame (this=0x6b5850, > frameSize=1316, numTruncatedBytes=0) at TCPStreamSink.cpp:104 > #4 0x0000000000449e06 in TCPStreamSink::afterGettingFrame > (clientData=0x6b5850, > frameSize=1316, numTruncatedBytes=0) at TCPStreamSink.cpp:94 > #5 0x000000000042ab0b in FramedSource::afterGetting (source=0x6b3f10) > at FramedSource.cpp:91 > #6 0x00000000004417e8 in MPEG2TransportStreamFramer::afterGettingFrame1 ( > this=0x6b3f10, frameSize=1316, presentationTime=...) > at MPEG2TransportStreamFramer.cpp:192 > #7 0x0000000000441567 in MPEG2TransportStreamFramer::afterGettingFrame ( > clientData=0x6b3f10, frameSize=1316, presentationTime=...) > at MPEG2TransportStreamFramer.cpp:136 > #8 0x000000000042ab0b in FramedSource::afterGetting (source=0x6b3e40) > at FramedSource.cpp:91 > #9 0x000000000042b5f6 in ByteStreamFileSource::doReadFromFile > (this=0x6b3e40) > at ByteStreamFileSource.cpp:179 > #10 0x000000000042b38f in ByteStreamFileSource::fileReadableHandler > (source=0x6b3e40) > at ByteStreamFileSource.cpp:123 > #11 0x000000000046ad90 in BasicTaskScheduler::SingleStep (this=0x6a8010, > maxDelayTime=0) at BasicTaskScheduler.cpp:163 > #12 0x000000000046d4aa in BasicTaskScheduler0::doEventLoop (this=0x6a8010, > watchVariable=0x0) at BasicTaskScheduler0.cpp:80 > #13 0x0000000000402556 in main (argc=1, argv=0x7fffffffe4a8) > at live555MediaServer.cpp:88 > > The crash happens on the 0113 release too. Here is a valgrind report with HLS streaming running, so it seems the crashing problem is not on MediaSink::onSourceClosure() being called twice in getNextFrame. ==31388== Invalid read of size 8 ==31388== at 0x4031C0: Medium::envir() const (Media.hh:59) ==31388== by 0x403C08: MediaSink::onSourceClosure() (MediaSink.cpp:99) ==31388== by 0x449D49: TCPStreamSink::processBuffer() (TCPStreamSink.cpp:75) ==31388== by 0x449E8C: TCPStreamSink::afterGettingFrame(unsigned int, unsigned int) (TCPStreamSink.cpp:104) ==31388== by 0x449E05: TCPStreamSink::afterGettingFrame(void*, unsigned int, unsigned int, timeval, unsigned int) (TCPStreamSink.cpp:94) ==31388== by 0x42AB0A: FramedSource::afterGetting(FramedSource*) (FramedSource.cpp:91) ==31388== by 0x4417E7: MPEG2TransportStreamFramer::afterGettingFrame1(unsigned int, timeval) (MPEG2TransportStreamFramer.cpp:192) ==31388== by 0x441566: MPEG2TransportStreamFramer::afterGettingFrame(void*, unsigned int, unsigned int, timeval, unsigned int) (MPEG2TransportStreamFramer.cpp:136) ==31388== by 0x42AB0A: FramedSource::afterGetting(FramedSource*) (FramedSource.cpp:91) ==31388== by 0x42B5F5: ByteStreamFileSource::doReadFromFile() (ByteStreamFileSource.cpp:179) ==31388== by 0x42B38E: ByteStreamFileSource::fileReadableHandler(ByteStreamFileSource*, int) (ByteStreamFileSource.cpp:123) ==31388== by 0x46AD8F: BasicTaskScheduler::SingleStep(unsigned int) (BasicTaskScheduler.cpp:163) ==31388== Address 0x5a82278 is 8 bytes inside a block of size 10,096 free'd ==31388== at 0x4C2836C: operator delete(void*) (vg_replace_malloc.c:480) ==31388== by 0x449A7D: TCPStreamSink::~TCPStreamSink() (TCPStreamSink.cpp:35) ==31388== by 0x40376F: MediaLookupTable::remove(char const*) (Media.cpp:151) ==31388== by 0x403392: Medium::close(UsageEnvironment&, char const*) (Media.cpp:53) ==31388== by 0x4033CF: Medium::close(Medium*) (Media.cpp:59) ==31388== by 0x414761: RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::~RTSPClientConnectionSupportingHTTPStreaming() (RTSPServerSupportingHTTPStreaming.cpp:59) ==31388== by 0x4147C1: RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::~RTSPClientConnectionSupportingHTTPStreaming() (RTSPServerSupportingHTTPStreaming.cpp:60) ==31388== by 0x415211: RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::afterStreaming(void*) (RTSPServerSupportingHTTPStreaming.cpp:260) ==31388== by 0x403C60: MediaSink::onSourceClosure() (MediaSink.cpp:103) ==31388== by 0x449D49: TCPStreamSink::processBuffer() (TCPStreamSink.cpp:75) ==31388== by 0x449ED4: TCPStreamSink::ourOnSourceClosure1() (TCPStreamSink.cpp:115) ==31388== by 0x449EAF: TCPStreamSink::ourOnSourceClosure(void*) (TCPStreamSink.cpp:109) Thanks. Park
_______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel