decoder/ffmpeg: fix crash on out-of-memory
Fixes regression by commit 7c8038e
This commit is contained in:
@@ -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;
|
||||||
|
Reference in New Issue
Block a user