[FFmpeg-devel] [PATCH 1/2] avformat/movenc: propagate shift_data errors properly

Marton Balint cus at passwd.hu
Sun May 29 17:17:13 CEST 2016


The second one is not explicitly needed, as res is not reset, but it is there
for consistency.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/movenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 49cd1bd..fbb659d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5732,7 +5732,8 @@ static int mov_write_trailer(AVFormatContext *s)
 
         if (mov->flags & FF_MOV_FLAG_FASTSTART) {
             av_log(s, AV_LOG_INFO, "Starting second pass: moving the moov atom to the beginning of the file\n");
-            res = shift_data(s);
+            if ((res = shift_data(s)) < 0)
+                goto error;
             if (res == 0) {
                 avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
                 if ((res = mov_write_moov_tag(pb, mov, s)) < 0)
@@ -5763,7 +5764,8 @@ static int mov_write_trailer(AVFormatContext *s)
            mov->tracks[i].data_offset = 0;
         if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
             av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n");
-            res = shift_data(s);
+            if ((res = shift_data(s)) < 0)
+                goto error;
             if (res == 0) {
                 int64_t end = avio_tell(pb);
                 avio_seek(pb, mov->reserved_header_pos, SEEK_SET);
-- 
2.6.6



More information about the ffmpeg-devel mailing list