forked from mirror/openmw-tes3mp
Fix crash when avcodec_decode_audio4 doesn't return a full frame (Fixes #2088)
This commit is contained in:
parent
0ce1732edb
commit
efa4d09c48
1 changed files with 5 additions and 2 deletions
|
@ -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…
Reference in a new issue