decoder/ffmpeg: simplify ffmpeg_send_packet()

This commit is contained in:
Max Kellermann 2014-12-18 23:21:48 +01:00
parent 0f2a304d34
commit 49f6b50ed3

View File

@ -335,11 +335,15 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
break;
}
packet2.data += len;
packet2.size -= len;
if (!got_frame)
continue;
uint8_t *output_buffer = nullptr;
int audio_size = 0;
if (got_frame) {
audio_size = copy_interleave_frame(codec_context,
frame,
int audio_size =
copy_interleave_frame(codec_context, frame,
&output_buffer,
buffer);
if (audio_size < 0) {
@ -348,10 +352,6 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
LogFfmpegError(audio_size);
return DecoderCommand::STOP;
}
}
packet2.data += len;
packet2.size -= len;
if (audio_size <= 0)
continue;