[MPlayer-cvslog] r33793 - trunk/libmpdemux/demux_rtp.cpp

reimar subversion at mplayerhq.hu
Fri Jul 1 22:54:58 CEST 2011


Author: reimar
Date: Fri Jul  1 22:54:57 2011
New Revision: 33793

Log:
Add a hack to receive audio while probing video FPS.

Otherwise newer live555 versions would just hang.
Fixes bug #1874.

Modified:
   trunk/libmpdemux/demux_rtp.cpp

Modified: trunk/libmpdemux/demux_rtp.cpp
==============================================================================
--- trunk/libmpdemux/demux_rtp.cpp	Fri Jul  1 21:08:13 2011	(r33792)
+++ trunk/libmpdemux/demux_rtp.cpp	Fri Jul  1 22:54:57 2011	(r33793)
@@ -496,11 +496,32 @@ static demux_packet_t* getBuffer(demuxer
   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;
@@ -558,6 +579,10 @@ static demux_packet_t* getBuffer(demuxer
   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;


More information about the MPlayer-cvslog mailing list