Commit 8729698d authored by Martin Storsjö's avatar Martin Storsjö

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@libav.org
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 7ff3fd7a
...@@ -1867,6 +1867,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -1867,6 +1867,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
rt->cur_transport_priv = NULL; rt->cur_transport_priv = NULL;
} }
redo:
if (rt->transport == RTSP_TRANSPORT_RTP) { if (rt->transport == RTSP_TRANSPORT_RTP) {
int i; int i;
int64_t first_queue_time = 0; int64_t first_queue_time = 0;
...@@ -1882,12 +1883,15 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -1882,12 +1883,15 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
first_queue_st = rt->rtsp_streams[i]; first_queue_st = rt->rtsp_streams[i];
} }
} }
if (first_queue_time) if (first_queue_time) {
wait_end = first_queue_time + s->max_delay; wait_end = first_queue_time + s->max_delay;
} else {
wait_end = 0;
first_queue_st = NULL;
}
} }
/* read next RTP packet */ /* read next RTP packet */
redo:
if (!rt->recvbuf) { if (!rt->recvbuf) {
rt->recvbuf = av_malloc(RECVBUF_SIZE); rt->recvbuf = av_malloc(RECVBUF_SIZE);
if (!rt->recvbuf) if (!rt->recvbuf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment