From ed60129bb2051649de3740ff75a7db71db9e7897 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 9 Jan 2015 15:45:13 +0000 Subject: Forward-port 99% crash fix from 1.x. --- src/lib/ffmpeg_decoder.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 2d12ef0a0..ec4e33a6e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -177,8 +177,9 @@ FFmpegDecoder::deinterleave_audio (uint8_t** data, int size) /* Deinterleave and convert to float */ - DCPOMATIC_ASSERT ((size % (bytes_per_audio_sample() * _ffmpeg_content->audio_channels())) == 0); - + /* total_samples and frames will be rounded down here, so if there are stray samples at the end + of the block that do not form a complete sample or frame they will be dropped. + */ int const total_samples = size / bytes_per_audio_sample(); int const frames = total_samples / _ffmpeg_content->audio_channels(); shared_ptr audio (new AudioBuffers (_ffmpeg_content->audio_channels(), frames)); -- cgit v1.2.3