Cope with loading a film containing a missing DCP which itself contains subtitles.
[dcpomatic.git] / src / lib / ffmpeg_file_encoder.cc
index f96a9458ec132c92993a138d39bf8e38094a0b33..6d1ad68f79bb79d939e4baf25991b792ef4bbaa9 100644 (file)
@@ -388,7 +388,7 @@ FFmpegFileEncoder::flush ()
                }
 
                flushed_audio = true;
-               for (auto i: _audio_streams) {
+               for (auto const& i: _audio_streams) {
                        if (!i->flush()) {
                                flushed_audio = false;
                        }
@@ -396,7 +396,9 @@ FFmpegFileEncoder::flush ()
        }
 
        auto const r = av_write_trailer(_format_context);
-       DCPOMATIC_ASSERT(r == 0);
+       if (r) {
+               throw EncodeError(N_("av_write_trailer"), N_("FFmpegFileEncoder::flush"), r);
+       }
 }