aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-11 10:58:06 +0100
committerMax Kellermann <max@duempel.org>2014-12-11 10:58:06 +0100
commit7c8038e2da61e02d8256311e65c27e9b9236e891 (patch)
treec796417b54bfd30db73e67bcb595885ad25ed328 /src/decoder
parent673336297d58af9afd61ab5689cfc8a6e996e790 (diff)
downloadmpd-7c8038e2da61e02d8256311e65c27e9b9236e891.tar.gz
mpd-7c8038e2da61e02d8256311e65c27e9b9236e891.tar.xz
mpd-7c8038e2da61e02d8256311e65c27e9b9236e891.zip
decoder/ffpmeg: simplify ffmpeg_send_packet()
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/plugins/FfmpegDecoderPlugin.cxx16
1 files 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;