From 7c8038e2da61e02d8256311e65c27e9b9236e891 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 11 Dec 2014 10:58:06 +0100 Subject: [PATCH] decoder/ffpmeg: simplify ffmpeg_send_packet() --- src/decoder/plugins/FfmpegDecoderPlugin.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 965a479ad..aba1810d5 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -332,7 +332,14 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is, int len = avcodec_decode_audio4(codec_context, frame, &got_frame, &packet2); - if (len >= 0 && got_frame) { + if (len < 0) { + /* if error, we skip the frame */ + LogDefault(ffmpeg_domain, + "decoding failed, frame skipped"); + break; + } + + if (got_frame) { audio_size = copy_interleave_frame(codec_context, frame, &output_buffer, @@ -341,13 +348,6 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is, len = audio_size; } - if (len < 0) { - /* if error, we skip the frame */ - LogDefault(ffmpeg_domain, - "decoding failed, frame skipped"); - break; - } - packet2.data += len; packet2.size -= len;