зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1270016: P3. Only check audio format at decode time. r=kamidphish
With raw streaming flac, we can't determine the audio format at the time the codec is opened. Additionally, when using streaming flac, we do not have a STREAMINFO block. The FFmpeg flac decoder check that extradata is null and not its size and would error due to an invalid extradata. MozReview-Commit-ID: KZ3n8b8WUMo --HG-- extra : rebase_source : a0dd8f517d730b1414c6461fc5c5e5b08d0d8b10
This commit is contained in:
Родитель
f06897e560
Коммит
e3d7cee89e
|
@ -21,8 +21,10 @@ FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(FFmpegLibWrapper* aLib,
|
|||
{
|
||||
MOZ_COUNT_CTOR(FFmpegAudioDecoder);
|
||||
// Use a new MediaByteBuffer as the object will be modified during initialization.
|
||||
mExtraData = new MediaByteBuffer;
|
||||
mExtraData->AppendElements(*aConfig.mCodecSpecificConfig);
|
||||
if (aConfig.mCodecSpecificConfig && aConfig.mCodecSpecificConfig->Length()) {
|
||||
mExtraData = new MediaByteBuffer;
|
||||
mExtraData->AppendElements(*aConfig.mCodecSpecificConfig);
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<MediaDataDecoder::InitPromise>
|
||||
|
@ -142,6 +144,16 @@ FFmpegAudioDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample)
|
|||
return DecodeResult::DECODE_ERROR;
|
||||
}
|
||||
|
||||
if (mFrame->format != AV_SAMPLE_FMT_FLT &&
|
||||
mFrame->format != AV_SAMPLE_FMT_FLTP &&
|
||||
mFrame->format != AV_SAMPLE_FMT_S16 &&
|
||||
mFrame->format != AV_SAMPLE_FMT_S16P &&
|
||||
mFrame->format != AV_SAMPLE_FMT_S32 &&
|
||||
mFrame->format != AV_SAMPLE_FMT_S32P) {
|
||||
NS_WARNING("FFmpeg audio decoder outputs unsupported audio format.");
|
||||
return DecodeResult::DECODE_ERROR;
|
||||
}
|
||||
|
||||
if (decoded) {
|
||||
uint32_t numChannels = mCodecContext->channels;
|
||||
AudioConfig::ChannelLayout layout(numChannels);
|
||||
|
|
|
@ -86,17 +86,6 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (mCodecContext->codec_type == AVMEDIA_TYPE_AUDIO &&
|
||||
mCodecContext->sample_fmt != AV_SAMPLE_FMT_FLT &&
|
||||
mCodecContext->sample_fmt != AV_SAMPLE_FMT_FLTP &&
|
||||
mCodecContext->sample_fmt != AV_SAMPLE_FMT_S16 &&
|
||||
mCodecContext->sample_fmt != AV_SAMPLE_FMT_S16P &&
|
||||
mCodecContext->sample_fmt != AV_SAMPLE_FMT_S32 &&
|
||||
mCodecContext->sample_fmt != AV_SAMPLE_FMT_S32P) {
|
||||
NS_WARNING("FFmpeg audio decoder outputs unsupported audio format.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
FFMPEG_LOG("FFmpeg init successful.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче