Fix crash when avcodec_decode_audio4 doesn't return a full frame (Fixes #2088)

loadfix
scrawl 10 years ago
parent 0ce1732edb
commit efa4d09c48

@ -107,6 +107,9 @@ bool FFmpeg_Decoder::getAVAudioData()
av_shrink_packet(&mPacket, remaining);
}
if (!got_frame || mFrame->nb_samples == 0)
continue;
if(mSwr)
{
if(!mDataBuf || mDataBufLen < mFrame->nb_samples)
@ -114,7 +117,7 @@ bool FFmpeg_Decoder::getAVAudioData()
av_freep(&mDataBuf);
if(av_samples_alloc(&mDataBuf, NULL, av_get_channel_layout_nb_channels(mOutputChannelLayout),
mFrame->nb_samples, mOutputSampleFormat, 0) < 0)
break;
return false;
else
mDataBufLen = mFrame->nb_samples;
}
@ -122,7 +125,7 @@ bool FFmpeg_Decoder::getAVAudioData()
if(swr_convert(mSwr, (uint8_t**)&mDataBuf, mFrame->nb_samples,
(const uint8_t**)mFrame->extended_data, mFrame->nb_samples) < 0)
{
break;
return false;
}
mFrameData = &mDataBuf;
}

Loading…
Cancel
Save