Commit 2dfe2fb2 authored by Max Kellermann's avatar Max Kellermann

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

Fixes regression by commit 7c8038e2
parent e8564b4c
...@@ -340,15 +340,19 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is, ...@@ -340,15 +340,19 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
break; break;
} }
uint8_t *output_buffer; uint8_t *output_buffer = nullptr;
int audio_size = 0; int audio_size = 0;
if (got_frame) { if (got_frame) {
audio_size = copy_interleave_frame(codec_context, audio_size = copy_interleave_frame(codec_context,
frame, frame,
&output_buffer, &output_buffer,
buffer, buffer_size); buffer, buffer_size);
if (audio_size < 0) if (audio_size < 0) {
len = audio_size; /* this must be a serious error,
e.g. OOM */
LogFfmpegError(audio_size);
return DecoderCommand::STOP;
}
} }
packet2.data += len; packet2.data += len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment