decoder/ffmpeg: fix crash on out-of-memory

Fixes regression by commit 7c8038e
This commit is contained in:
Max Kellermann 2014-12-18 22:13:01 +01:00
parent e8564b4c90
commit 2dfe2fb22c

View File

@ -340,15 +340,19 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
break;
}
uint8_t *output_buffer;
uint8_t *output_buffer = nullptr;
int audio_size = 0;
if (got_frame) {
audio_size = copy_interleave_frame(codec_context,
frame,
&output_buffer,
buffer, buffer_size);
if (audio_size < 0)
len = audio_size;
if (audio_size < 0) {
/* this must be a serious error,
e.g. OOM */
LogFfmpegError(audio_size);
return DecoderCommand::STOP;
}
}
packet2.data += len;