diff mbox series

[FFmpeg-devel,2/2] avformat/demux: Combine "Packet corrupt" logmessages

Message ID DU0P250MB07475CA3F526BB4B39AEBBA18F322@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit ccd2b7f858d2b1d10a49629aa9b24055b7cc5646
Headers show
Series [FFmpeg-devel,1/2] avformat/demux: Restore pkt->stream_index assert check | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt March 21, 2024, 12:34 p.m. UTC
Otherwise these statements might be torn apart by
av_logs from other threads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/demux.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 4345ed4c8c..e50d1a9cfe 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -572,14 +572,13 @@  static int handle_new_packet(AVFormatContext *s, AVPacket *pkt, int allow_passth
 
     if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
         av_log(s, AV_LOG_WARNING,
-               "Packet corrupt (stream = %d, dts = %s)",
-               pkt->stream_index, av_ts2str(pkt->dts));
+               "Packet corrupt (stream = %d, dts = %s)%s.\n",
+               pkt->stream_index, av_ts2str(pkt->dts),
+               s->flags & AVFMT_FLAG_DISCARD_CORRUPT ? ", dropping it" : "");
         if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) {
-            av_log(s, AV_LOG_WARNING, ", dropping it.\n");
             av_packet_unref(pkt);
             return 1;
         }
-        av_log(s, AV_LOG_WARNING, ".\n");
     }
 
     st  = s->streams[pkt->stream_index];