diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-02-13 00:29:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-02-13 20:17:56 +0100 |
| commit | 1dffa893a0f7042bd50500246ac94d70efa23bdc (patch) | |
| tree | 42dfbf43139302d3c56b87cbd92ff241bf650b60 | |
| parent | d2929a5dea6639f1896fb69929a4913e3d4f4fb5 (diff) | |
Relax error handling when examining FFmpeg files (#2187).
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 9 | ||||
| -rw-r--r-- | test/ffmpeg_examiner_test.cc | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 5e53f0974..3c6d185f4 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -264,12 +264,9 @@ FFmpegExaminer::audio_packet (AVCodecContext* context, shared_ptr<FFmpegAudioStr } int r = avcodec_send_packet (context, packet); - if (r < 0 && !(r == AVERROR_EOF && !packet) && r != AVERROR(EAGAIN)) { - /* We could cope with AVERROR(EAGAIN) and re-send the packet but I think it should never happen. - * AVERROR_EOF can happen during flush if we've already sent a flush packet. - * EAGAIN means we need to do avcodec_receive_frame, so just carry on and do that. - */ - throw DecodeError (N_("avcodec_send_packet"), N_("FFmpegExaminer::audio_packet"), r); + if (r < 0) { + LOG_WARNING("avcodec_send_packet returned %1 for an audio packet", r); + return; } auto frame = audio_frame (stream); diff --git a/test/ffmpeg_examiner_test.cc b/test/ffmpeg_examiner_test.cc index 655fd1437..c460830fb 100644 --- a/test/ffmpeg_examiner_test.cc +++ b/test/ffmpeg_examiner_test.cc @@ -67,3 +67,12 @@ BOOST_AUTO_TEST_CASE (ffmpeg_examiner_probesize_test) BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->frame_rate(), 48000); BOOST_CHECK_EQUAL (examiner->audio_streams()[1]->channels(), 5); } + + +/** Check that a file can be examined without error */ +BOOST_AUTO_TEST_CASE (ffmpeg_examiner_vob_test) +{ + auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "bad.vob"); + auto examiner = make_shared<FFmpegExaminer>(content); +} + |
