Bug 1139779: Part4. Make FFmpeg video decoder use AVCC. r=edwin

FFmpeg h264 decoder doesn't handle change of SPS in-band and only use the first
found.
This commit is contained in:
Jean-Yves Avenard 2015-03-10 21:19:42 +11:00
Родитель b849b45758
Коммит 313c854fd3
3 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -149,9 +149,10 @@ PlatformDecoderModule::CreatePDM()
#endif
#ifdef MOZ_FFMPEG
if (sFFmpegDecoderEnabled) {
nsRefPtr<PlatformDecoderModule> m(FFmpegRuntimeLinker::CreateDecoderModule());
nsRefPtr<PlatformDecoderModule> m = FFmpegRuntimeLinker::CreateDecoderModule();
if (m) {
return m.forget();
nsRefPtr<PlatformDecoderModule> m2(new AVCCDecoderModule(m));
return m2.forget();
}
}
#endif

Просмотреть файл

@ -63,6 +63,11 @@ public:
return FFmpegH264Decoder<V>::GetCodecId(aMimeType) != AV_CODEC_ID_NONE;
}
virtual bool DecoderNeedsAVCC(const mp4_demuxer::VideoDecoderConfig& aConfig) MOZ_OVERRIDE
{
return true;
}
};
} // namespace mozilla

Просмотреть файл

@ -36,6 +36,7 @@ FFmpegH264Decoder<LIBAV_VER>::FFmpegH264Decoder(
, mDisplayHeight(aConfig.display_height)
{
MOZ_COUNT_CTOR(FFmpegH264Decoder);
mExtraData = aConfig.extra_data;
mp4_demuxer::SPSData spsdata;
if (mp4_demuxer::H264::DecodeSPSFromExtraData(aConfig.extra_data, spsdata)) {
mDisplayWidth = spsdata.display_width;
@ -61,12 +62,6 @@ FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(mp4_demuxer::MP4Sample* aSample)
AVPacket packet;
av_init_packet(&packet);
if (!mp4_demuxer::AnnexB::ConvertSampleToAnnexB(aSample)) {
NS_WARNING("FFmpeg h264 decoder failed to convert sample to Annex B.");
mCallback->Error();
return DecodeResult::DECODE_ERROR;
}
if (!aSample->Pad(FF_INPUT_BUFFER_PADDING_SIZE)) {
NS_WARNING("FFmpeg h264 decoder failed to allocate sample.");
mCallback->Error();