[FFmpeg-devel] [PATCH] avformat/utils: log corrupt packets

Gyan Doshi ffmpeg at gyani.pro
Thu Dec 26 16:54:54 EET 2019


---
 libavformat/utils.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index b83a740500..7ac3920257 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -876,13 +876,16 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (err < 0)
             return err;
 
-        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
-            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
+        if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
             av_log(s, AV_LOG_WARNING,
-                   "Dropped corrupted packet (stream = %d)\n",
-                   pkt->stream_index);
-            av_packet_unref(pkt);
-            continue;
+                   "Packet corrupt (stream = %d, dts = %s)",
+                   pkt->stream_index, av_ts2str(pkt->pkt.dts));
+            if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) {
+                av_log(s, AV_LOG_WARNING, ", dropping it.\n");
+                av_packet_unref(pkt);
+                continue;
+            }
+            av_log(s, AV_LOG_WARNING, ".\n");
         }
 
         if (pkt->stream_index >= (unsigned)s->nb_streams) {
-- 
2.24.1



More information about the ffmpeg-devel mailing list