[FFmpeg-devel] [PATCH 2/2] avformat/mux: Unify setting number of muxed packets
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Thu Mar 12 19:54:08 EET 2020
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavformat/mux.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/libavformat/mux.c b/libavformat/mux.c
index bc2eab0c96..bfd1bf491b 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -763,7 +763,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0) {
pkt->pts = pts_backup;
pkt->dts = dts_backup;
- }
+ } else
+ s->streams[pkt->stream_index]->nb_frames++;
return ret;
}
@@ -912,11 +913,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
return ret;
#endif
- ret = write_packet(s, pkt);
-
- if (ret >= 0)
- s->streams[pkt->stream_index]->nb_frames++;
- return ret;
+ return write_packet(s, pkt);
}
#define CHUNK_START 0x1000
@@ -1237,8 +1234,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
return ret;
ret = write_packet(s, &opkt);
- if (ret >= 0)
- s->streams[opkt.stream_index]->nb_frames++;
av_packet_unref(&opkt);
@@ -1263,8 +1258,6 @@ int av_write_trailer(AVFormatContext *s)
break;
ret = write_packet(s, &pkt);
- if (ret >= 0)
- s->streams[pkt.stream_index]->nb_frames++;
av_packet_unref(&pkt);
--
2.20.1
More information about the ffmpeg-devel
mailing list