avformat/demux: Combine "Packet corrupt" logmessages

Otherwise these statements might be torn apart by
av_logs from other threads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-03-21 13:32:29 +01:00
parent 07064f9bda
commit ccd2b7f858
1 changed files with 3 additions and 4 deletions

View File

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