[FFmpeg-cvslog] avformat/mux: Unify setting number of muxed packets

Andreas Rheinhardt git at videolan.org
Sat Mar 14 19:27:52 EET 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Mar 12 18:54:08 2020 +0100| [fa5bff611da2f628e110a2d23831ca18c076da21] | committer: Michael Niedermayer

avformat/mux: Unify setting number of muxed packets

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa5bff611da2f628e110a2d23831ca18c076da21
---

 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);
 



More information about the ffmpeg-cvslog mailing list