Index: libmpdemux/demux_rtp.cpp =================================================================== --- libmpdemux/demux_rtp.cpp (Revision 23185) +++ libmpdemux/demux_rtp.cpp (Arbeitskopie) @@ -448,6 +448,10 @@ RTPState* rtpState = (RTPState*)(demuxer->priv); ReadBufferQueue* bufferQueue = NULL; int headersize = 0; + TaskToken task; + + if (demuxer->stream->eof) return NULL; + if (ds == demuxer->video) { bufferQueue = rtpState->videoBufferQueue; if (((sh_video_t*)ds->sh)->format == mmioFOURCC('H','2','6','4')) @@ -500,7 +504,11 @@ // Block ourselves until data becomes available: TaskScheduler& scheduler = bufferQueue->readSource()->envir().taskScheduler(); + int delay = bufferQueue->prevPacketPTS * 1.05 > + rtpState->mediaSession->playEndTime() ? 2000000 : 10000000; + task = scheduler.scheduleDelayedTask(delay, onSourceClosure, bufferQueue); scheduler.doEventLoop(&bufferQueue->blockingFlag); + scheduler.unscheduleDelayedTask(task); if (headersize == 1) // amr dp->buffer[0] = @@ -510,7 +518,7 @@ bufferQueue->dp = dp = bufferQueue->nextpacket; bufferQueue->nextpacket = NULL; } - if (headersize == 3 && h264parserctx) { // h264 + if (headersize == 3 && h264parserctx && !demuxer->stream->eof) { // h264 consumed = h264parserctx->parser->parser_parse(h264parserctx, NULL, &poutbuf, &poutbuf_size,