+pair<int, bool>
+FFmpegDecoder::decode_audio_packet (shared_ptr<FFmpegAudioStream> stream, AVPacket* packet)
+{
+ int frame_finished;
+ DCPOMATIC_DISABLE_WARNINGS
+ int decode_result = avcodec_decode_audio4 (stream->stream(_format_context)->codec, _frame, &frame_finished, packet);
+ DCPOMATIC_ENABLE_WARNINGS
+ if (decode_result < 0) {
+ /* avcodec_decode_audio4 can sometimes return an error even though it has decoded
+ some valid data; for example dca_subframe_footer can return AVERROR_INVALIDDATA
+ if it overreads the auxiliary data. ffplay carries on if frame_finished is true,
+ even in the face of such an error, so I think we should too.
+
+ Returning from the method here caused mantis #352.
+ */
+ LOG_WARNING ("avcodec_decode_audio4 failed (%1)", decode_result);
+ }
+ return make_pair(decode_result, frame_finished);
+}
+
+