aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/FfmpegDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-18 22:13:01 +0100
committerMax Kellermann <max@duempel.org>2014-12-18 22:24:02 +0100
commit2dfe2fb22c332e15f9a45d5a3ad548d6a602ceda (patch)
treeb2eac1a8dcbf7e3d8fbc676eb228dc34d3e2047e /src/decoder/plugins/FfmpegDecoderPlugin.cxx
parente8564b4c9053f2e54585b8982ee8388c1e893b95 (diff)
downloadmpd-2dfe2fb22c332e15f9a45d5a3ad548d6a602ceda.tar.gz
mpd-2dfe2fb22c332e15f9a45d5a3ad548d6a602ceda.tar.xz
mpd-2dfe2fb22c332e15f9a45d5a3ad548d6a602ceda.zip
decoder/ffmpeg: fix crash on out-of-memory
Fixes regression by commit 7c8038e
Diffstat (limited to '')
-rw-r--r--src/decoder/plugins/FfmpegDecoderPlugin.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
index e7f2ebfb0..60c49800d 100644
--- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx
@@ -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;