[FFmpeg-cvslog] rtsp: Recheck the reordering queue if getting a new packet

Martin Storsjö git at videolan.org
Thu Jan 17 02:41:29 CET 2013


ffmpeg | branch: release/0.10 | Martin Storsjö <martin at martin.st> | Mon Jan  7 18:39:04 2013 +0200| [d1d329932fd47d5e0fd4ca3c37827b98981c62cd] | committer: Reinhard Tartler

rtsp: Recheck the reordering queue if getting a new packet

If we timed out and consumed a packet from the reordering queue,
but didn't return a packet to the caller, recheck the queue status.
Otherwise, we could end up in an infinite loop, trying to consume
a queued packet that has already been consumed.

CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 8729698d50739524665090e083d1bfdf28235724)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1d329932fd47d5e0fd4ca3c37827b98981c62cd
---

 libavformat/rtsp.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 2858a9a..5a691f2 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1711,6 +1711,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
             rt->cur_transport_priv = NULL;
     }
 
+redo:
     if (rt->transport == RTSP_TRANSPORT_RTP) {
         int i;
         int64_t first_queue_time = 0;
@@ -1726,12 +1727,15 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
                 first_queue_st   = rt->rtsp_streams[i];
             }
         }
-        if (first_queue_time)
+        if (first_queue_time) {
             wait_end = first_queue_time + s->max_delay;
+        } else {
+            wait_end = 0;
+            first_queue_st = NULL;
+        }
     }
 
     /* read next RTP packet */
- redo:
     if (!rt->recvbuf) {
         rt->recvbuf = av_malloc(RECVBUF_SIZE);
         if (!rt->recvbuf)



More information about the ffmpeg-cvslog mailing list