diff options
Diffstat (limited to 'libmpdemux/demux_rtp.cpp')
-rw-r--r-- | libmpdemux/demux_rtp.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libmpdemux/demux_rtp.cpp b/libmpdemux/demux_rtp.cpp index e93616d07f..c9c950de8a 100644 --- a/libmpdemux/demux_rtp.cpp +++ b/libmpdemux/demux_rtp.cpp @@ -498,11 +498,32 @@ static demux_packet_t* getBuffer(demuxer_t* demuxer, demux_stream_t* ds, RTPState* rtpState = (RTPState*)(demuxer->priv); ReadBufferQueue* bufferQueue = NULL; int headersize = 0; - TaskToken task; + int waitboth = 0; + TaskToken task, task2; if (demuxer->stream->eof) return NULL; if (ds == demuxer->video) { + bufferQueue = rtpState->audioBufferQueue; + // HACK: for the latest versions we must also receive audio + // when probing for video FPS, otherwise the stream just hangs + // and times out + if (mustGetNewData && + bufferQueue && + bufferQueue->readSource() && + !bufferQueue->nextpacket) { + headersize = bufferQueue->readSource()->isAMRAudioSource() ? 1 : 0; + demux_packet_t *dp = new_demux_packet(MAX_RTP_FRAME_SIZE); + bufferQueue->dp = dp; + bufferQueue->blockingFlag = 0; + bufferQueue->readSource()->getNextFrame( + &dp->buffer[headersize], MAX_RTP_FRAME_SIZE - headersize, + afterReading, bufferQueue, + onSourceClosure, bufferQueue); + task2 = bufferQueue->readSource()->envir().taskScheduler(). + scheduleDelayedTask(10000000, onSourceClosure, bufferQueue); + waitboth = 1; + } bufferQueue = rtpState->videoBufferQueue; if (((sh_video_t*)ds->sh)->format == mmioFOURCC('H','2','6','4')) headersize = 3; @@ -560,6 +581,10 @@ static demux_packet_t* getBuffer(demuxer_t* demuxer, demux_stream_t* ds, task = scheduler.scheduleDelayedTask(delay, onSourceClosure, bufferQueue); scheduler.doEventLoop(&bufferQueue->blockingFlag); scheduler.unscheduleDelayedTask(task); + if (waitboth) { + scheduler.doEventLoop(&rtpState->audioBufferQueue->blockingFlag); + scheduler.unscheduleDelayedTask(task2); + } if (demuxer->stream->eof) { free_demux_packet(dp); return NULL; |