[FFmpeg-cvslog] avconv: Do not pass NULL to avio_tell

Luca Barbato git at videolan.org
Fri May 19 11:59:23 EEST 2017


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Thu Dec 15 18:59:41 2016 +0100| [44129e38047b6a27291e487c2084894958c6f399] | committer: Luca Barbato

avconv: Do not pass NULL to avio_tell

The null demuxer does not have a backing AVIOContext.

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

 avconv.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/avconv.c b/avconv.c
index 5c31332812..fe606250fe 100644
--- a/avconv.c
+++ b/avconv.c
@@ -909,7 +909,7 @@ static void print_report(int is_last_report, int64_t timer_start)
     char buf[1024];
     OutputStream *ost;
     AVFormatContext *oc;
-    int64_t total_size;
+    int64_t total_size = 0;
     AVCodecContext *enc;
     int frame_number, vid, i;
     double bitrate, ti1, pts;
@@ -934,16 +934,17 @@ static void print_report(int is_last_report, int64_t timer_start)
 
 
     oc = output_files[0]->ctx;
-
-    total_size = avio_size(oc->pb);
-    if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too
-        total_size = avio_tell(oc->pb);
-    if (total_size < 0) {
-        char errbuf[128];
-        av_strerror(total_size, errbuf, sizeof(errbuf));
-        av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
-               "avio_tell() failed: %s\n", errbuf);
-        total_size = 0;
+    if (oc->pb) {
+        total_size = avio_size(oc->pb);
+        if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too
+            total_size = avio_tell(oc->pb);
+        if (total_size < 0) {
+            char errbuf[128];
+            av_strerror(total_size, errbuf, sizeof(errbuf));
+            av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
+                   "avio_tell() failed: %s\n", errbuf);
+            total_size = 0;
+        }
     }
 
     buf[0] = '\0';



More information about the ffmpeg-cvslog mailing list