decoder/ffpmeg: simplify ffmpeg_send_packet()

This commit is contained in:
Max Kellermann 2014-12-11 10:58:06 +01:00
parent 673336297d
commit 7c8038e2da
1 changed files with 8 additions and 8 deletions

View File

@ -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;