From: Steinar H. Gunderson Date: Tue, 17 Nov 2015 01:06:49 +0000 (+0100) Subject: Fix a crash bug when avcodec_fill_audio_frame() decided we needed more alignment. X-Git-Tag: 1.0.0~108 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=cecec498a9f90e5771666479872a5c9e5d789ef7;p=nageru Fix a crash bug when avcodec_fill_audio_frame() decided we needed more alignment. --- diff --git a/bmusb b/bmusb index 6a027cb..ec10aed 160000 --- a/bmusb +++ b/bmusb @@ -1 +1 @@ -Subproject commit 6a027cb2d982c385859150ad1558a1e205817844 +Subproject commit ec10aedf720f2356035255999827beb4158aa4a2 diff --git a/h264encode.cpp b/h264encode.cpp index a359726..0946eb0 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -1709,7 +1709,11 @@ void H264Encoder::save_codeddata(storage_task task) frame->channel_layout = AV_CH_LAYOUT_STEREO; unique_ptr int_samples(new int32_t[audio.size()]); - avcodec_fill_audio_frame(frame, 2, AV_SAMPLE_FMT_S32, (const uint8_t*)int_samples.get(), audio.size() * sizeof(int32_t), 0); + int ret = avcodec_fill_audio_frame(frame, 2, AV_SAMPLE_FMT_S32, (const uint8_t*)int_samples.get(), audio.size() * sizeof(int32_t), 1); + if (ret < 0) { + fprintf(stderr, "avcodec_fill_audio_frame() failed with %d\n", ret); + exit(1); + } for (int i = 0; i < frame->nb_samples * 2; ++i) { if (audio[i] >= 1.0f) { int_samples[i] = 2147483647;