Fix crash with no video.
authorCarl Hetherington <cth@carlh.net>
Tue, 10 May 2016 23:31:31 +0000 (00:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000 (11:50 +0100)
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_decoder.cc

index 32c2dee8b6d27662d6671cf9636e93c720ca7561..fdbdd4eb5050dd662d929ed2dc56eaf9b712758b 100644 (file)
@@ -276,12 +276,19 @@ FFmpegContent::technical_summary () const
 
        string filt = Filter::ffmpeg_string (_filters);
 
-       return Content::technical_summary() + " - "
-               + video->technical_summary() + " - "
-               + audio->technical_summary() + " - "
-               + String::compose (
-                       "ffmpeg: audio %1 subtitle %2 filters %3", as, ss, filt
-                       );
+       string s = Content::technical_summary ();
+
+       if (video) {
+               s += " - " + video->technical_summary ();
+       }
+
+       if (audio) {
+               s += " - " + audio->technical_summary ();
+       }
+
+       return s + String::compose (
+               "ffmpeg: audio %1 subtitle %2 filters %3", as, ss, filt
+               );
 }
 
 void
index 14c2e63e27ca11f75b737557bceb094ee02f3ab8..195167d4b6735b9804bf3d5d693472f8248f87d3 100644 (file)
@@ -111,10 +111,12 @@ FFmpegDecoder::flush ()
 
        /* XXX: should we reset _packet.data and size after each *_decode_* call? */
 
-       while (decode_video_packet ()) {}
+       while (video && decode_video_packet ()) {}
 
-       decode_audio_packet ();
-       audio->flush ();
+       if (audio) {
+               decode_audio_packet ();
+               audio->flush ();
+       }
 }
 
 bool