[FFmpeg-cvslog] Revert "avformat/mux: split side data earlier in av_write_frame and av_interleaved_write_frame"

James Almer git at videolan.org
Sat Nov 5 03:14:58 EET 2016


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Nov  4 21:58:49 2016 -0300| [6005c7e656962b4c6d13fe877828b4d24bf2974b] | committer: James Almer

Revert "avformat/mux: split side data earlier in av_write_frame and av_interleaved_write_frame"

This reverts commit fba2a8a254997e0db39a30438e96e5f3e44c669a.

The changes were right for av_write_frame() but not for av_interleaved_write_frame().
The following commit will fix this in a simpler way.

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavformat/mux.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 816e856..2dac381 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -692,7 +692,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
  */
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret;
+    int ret, did_split;
     int64_t pts_backup, dts_backup;
 
     pts_backup = pkt->pts;
@@ -755,6 +755,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
         }
     }
 
+    did_split = av_packet_split_side_data(pkt);
+
     if (!s->internal->header_written) {
         ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s);
         if (ret < 0)
@@ -778,6 +780,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
 fail:
+    if (did_split)
+        av_packet_merge_side_data(pkt);
+
     if (ret < 0) {
         pkt->pts = pts_backup;
         pkt->dts = dts_backup;
@@ -913,7 +918,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) {
 
 int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret, did_split = 0;
+    int ret;
 
     ret = prepare_input_packet(s, pkt);
     if (ret < 0)
@@ -934,8 +939,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
             return ret;
         }
         return 1;
-    } else
-        did_split = av_packet_split_side_data(pkt);
+    }
 
     ret = do_packet_auto_bsf(s, pkt);
     if (ret <= 0)
@@ -954,10 +958,6 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 
     if (ret >= 0)
         s->streams[pkt->stream_index]->nb_frames++;
-
-    if (did_split)
-        av_packet_merge_side_data(pkt);
-
     return ret;
 }
 
@@ -1224,7 +1224,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in
 
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret, did_split = 0, flush = 0;
+    int ret, flush = 0;
 
     ret = prepare_input_packet(s, pkt);
     if (ret < 0)
@@ -1233,8 +1233,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
     if (pkt) {
         AVStream *st = s->streams[pkt->stream_index];
 
-        did_split = av_packet_split_side_data(pkt);
-
         ret = do_packet_auto_bsf(s, pkt);
         if (ret == 0)
             return 0;
@@ -1282,9 +1280,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
             return s->pb->error;
     }
 fail:
-    if (did_split)
-        av_packet_merge_side_data(pkt);
-
     av_packet_unref(pkt);
     return ret;
 }



More information about the ffmpeg-cvslog mailing list