Give more detail when an assertion trips (#2828). 2828-jpeg
authorCarl Hetherington <cth@carlh.net>
Mon, 10 Jun 2024 20:55:34 +0000 (22:55 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 10 Jun 2024 20:55:34 +0000 (22:55 +0200)
src/lib/ffmpeg_image_proxy.cc

index 2fcd486dfafc72daa641f0a7c50e6c891c8c9d01..00d2a6a59515a60519a6a0e12854016ddaea0ab4 100644 (file)
@@ -171,7 +171,13 @@ FFmpegImageProxy::image (Image::Alignment alignment, optional<dcp::Size>) const
                throw DecodeError (N_("avcodec_find_stream_info"), name_for_errors, r, *_path);
        }
 
-       DCPOMATIC_ASSERT (format_context->nb_streams == 1);
+       if (format_context->nb_streams != 1) {
+               if (_path) {
+                       throw DecodeError("FFmpegProxy::image", String::compose("stream count %1", format_context->nb_streams), *_path);
+               } else {
+                       throw DecodeError("FFmpegProxy::image", String::compose("stream count %1", format_context->nb_streams));
+               }
+       }
 
        auto frame = av_frame_alloc ();
        if (!frame) {