зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1313398: P4. Check that the out of band extradata hasn't changed. r=gerald
On android, where decoders can sometimes be recycled, the h264converter can be fed over its lifetime MediaRawData with different mExtraData. So we need to ensure that not only, the inband ones don't change, but that the out of band one hasn't changed either. This is a condition we could totally ignore on desktop, as when the resolution change the H264Converter is destroyed. MozReview-Commit-ID: 7w6ku6by1Qi --HG-- extra : rebase_source : d35f07b372ef0623dbd74384aa5d3a865a3e067a
This commit is contained in:
Родитель
33005dac56
Коммит
ba837c02ae
|
@ -34,6 +34,11 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM,
|
|||
, mDecoderOptions(aParams.mOptions)
|
||||
{
|
||||
CreateDecoder(mOriginalConfig, aParams.mDiagnostics);
|
||||
if (mDecoder) {
|
||||
MOZ_ASSERT(mp4_demuxer::AnnexB::HasSPS(mOriginalConfig.mExtraData));
|
||||
// The video metadata contains out of band SPS/PPS (AVC1) store it.
|
||||
mOriginalExtraData = mOriginalConfig.mExtraData;
|
||||
}
|
||||
}
|
||||
|
||||
H264Converter::~H264Converter()
|
||||
|
@ -328,9 +333,24 @@ H264Converter::CheckForSPSChange(MediaRawData* aSample)
|
|||
{
|
||||
RefPtr<MediaByteBuffer> extra_data =
|
||||
mp4_demuxer::AnnexB::ExtractExtraData(aSample);
|
||||
if (!mp4_demuxer::AnnexB::HasSPS(extra_data)
|
||||
|| mp4_demuxer::AnnexB::CompareExtraData(extra_data,
|
||||
mCurrentConfig.mExtraData)) {
|
||||
if (!mp4_demuxer::AnnexB::HasSPS(extra_data)) {
|
||||
MOZ_ASSERT(mCanRecycleDecoder.isSome());
|
||||
if (!*mCanRecycleDecoder) {
|
||||
// If the decoder can't be recycled, the out of band extradata will never
|
||||
// change as the H264Converter will be recreated by the MediaFormatReader
|
||||
// instead. So there's no point in testing for changes.
|
||||
return NS_OK;
|
||||
}
|
||||
// This sample doesn't contain inband SPS/PPS
|
||||
// We now check if the out of band one has changed.
|
||||
if (mp4_demuxer::AnnexB::HasSPS(aSample->mExtraData) &&
|
||||
!mp4_demuxer::AnnexB::CompareExtraData(aSample->mExtraData,
|
||||
mOriginalExtraData)) {
|
||||
extra_data = mOriginalExtraData = aSample->mExtraData;
|
||||
}
|
||||
}
|
||||
if (mp4_demuxer::AnnexB::CompareExtraData(extra_data,
|
||||
mCurrentConfig.mExtraData)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ private:
|
|||
RefPtr<PlatformDecoderModule> mPDM;
|
||||
const VideoInfo mOriginalConfig;
|
||||
VideoInfo mCurrentConfig;
|
||||
// Current out of band extra data (as found in metadata's VideoInfo).
|
||||
RefPtr<MediaByteBuffer> mOriginalExtraData;
|
||||
RefPtr<layers::KnowsCompositor> mKnowsCompositor;
|
||||
RefPtr<layers::ImageContainer> mImageContainer;
|
||||
const RefPtr<TaskQueue> mTaskQueue;
|
||||
|
|
Загрузка…
Ссылка в новой задаче