[FFmpeg-cvslog] ffmpeg: check return value of avio_closep for progress report

Ganesh Ajjanagadde git at videolan.org
Wed Jan 6 04:09:05 CET 2016


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Mon Jan  4 19:33:50 2016 -0800| [a956840cbcf89d709c4bd5980808ac0b5c8aeedf] | committer: Ganesh Ajjanagadde

ffmpeg: check return value of avio_closep for progress report

avio_closep is not guaranteed to succeed, and its return value can
contain information regarding failure of preceding writes and silent
loss of data (man 2 close, man fclose). Users should know when the
progress was not successfully logged, and so a diagnostic is printed
here.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Reviewed-by: James Almer <jamrial at gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>

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

 ffmpeg.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index c533785..dd85356 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1501,6 +1501,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
     static int64_t last_time = -1;
     static int qp_histogram[52];
     int hours, mins, secs, us;
+    int ret;
     float t;
 
     if (!print_stats && !is_last_report && !progress_avio)
@@ -1667,7 +1668,9 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         avio_flush(progress_avio);
         av_bprint_finalize(&buf_script, NULL);
         if (is_last_report) {
-            avio_closep(&progress_avio);
+            if ((ret = avio_closep(&progress_avio)) < 0)
+                av_log(NULL, AV_LOG_ERROR,
+                       "Error closing progress log, loss of information possible: %s\n", av_err2str(ret));
         }
     }
 



More information about the ffmpeg-cvslog mailing list