diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-11-01 12:56:53 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-11-01 12:56:53 +0000 |
| commit | 9cc13afa143cd847d365cfbc8b5531e1f8cbb59e (patch) | |
| tree | 1a1672168fac4ea63710e75a341a4c321e4aa416 /src/lib/ffmpeg_decoder.cc | |
| parent | e9cefbb14d01b64853c07f36ebf42728676237f4 (diff) | |
Log on av_read_frame error (rather than aborting) and log on unused data in a packet.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 60f5bf7f5..09f699543 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -224,7 +224,10 @@ FFmpegDecoder::do_pass () if (r < 0) { if (r != AVERROR_EOF) { - throw DecodeError ("error on av_read_frame"); + /* Maybe we should fail here, but for now we'll just finish off instead */ + char buf[256]; + av_strerror (r, buf, sizeof(buf)); + _film->log()->log (String::compose ("error on av_read_frame (%1) (%2)", buf, r)); } /* Get any remaining frames */ @@ -259,7 +262,12 @@ FFmpegDecoder::do_pass () if (_packet.stream_index == _video_stream) { int frame_finished; - if (avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) { + int const r = avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet); + if (r >= 0 && frame_finished) { + + if (r != _packet.size) { + _film->log()->log (String::compose ("Used only %1 bytes of %2 in packet", r, _packet.size)); + } /* Where we are in the output, in seconds */ double const out_pts_seconds = video_frame_index() / frames_per_second(); |
