diff mbox series

[FFmpeg-devel,1/3] avformat/rtpdec: Fix negative missed packets in warning message

Message ID 1642909918-26903-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit d9f05bea5cc7a8c4bb0569eecbe24a26def7f476
Headers show
Series [FFmpeg-devel,1/3] avformat/rtpdec: Fix negative missed packets in warning message | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished

Commit Message

Lance Wang Jan. 23, 2022, 3:51 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/rtpdec.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 20fe2b8..f285a41 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -835,9 +835,14 @@  static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt)
     if (s->queue_len <= 0)
         return -1;
 
-    if (!has_next_packet(s))
+    if (!has_next_packet(s)) {
+        int pkt_missed  = s->queue->seq - s->seq - 1;
+
+        if (pkt_missed < 0)
+            pkt_missed += UINT16_MAX;
         av_log(s->ic, AV_LOG_WARNING,
-               "RTP: missed %d packets\n", s->queue->seq - s->seq - 1);
+               "RTP: missed %d packets\n", pkt_missed);
+    }
 
     /* Parse the first packet in the queue, and dequeue it */
     rv   = rtp_parse_packet_internal(s, pkt, s->queue->buf, s->queue->len);