Bug 1538508 - P3. Add options to scan all frames for SPS/PPS change. r=bryce

While not required in the two examples provided, should those streams change resolution and continue to use the same type of bytstreams we would miss the changes as the keyframe never contains the new SPS/PPS NALs.

So we add an option to handle this case, so we can separate the cases where this could be needed without regressing bug 1469257

Differential Revision: https://phabricator.services.mozilla.com/D24854

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-03-27 11:03:23 +00:00
Родитель c1838d082f
Коммит 92b55dddb6
3 изменённых файлов: 17 добавлений и 7 удалений

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

@ -48,6 +48,9 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
Default,
LowLatency,
HardwareDecoderNotAllowed,
FullH264Parsing,
SENTINEL // one past the last valid value
};
using OptionSet = EnumSet<Option>;
@ -146,7 +149,7 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
template <>
struct MaxEnumValue<::mozilla::CreateDecoderParams::Option> {
static constexpr unsigned int value = static_cast<unsigned int>(
CreateDecoderParams::Option::HardwareDecoderNotAllowed);
CreateDecoderParams::Option::SENTINEL);
};
// The PlatformDecoderModule interface is used by the MediaFormatReader to

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

@ -27,7 +27,8 @@ namespace mozilla {
class H264ChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
public:
explicit H264ChangeMonitor(const VideoInfo& aInfo) : mCurrentConfig(aInfo) {
explicit H264ChangeMonitor(const VideoInfo& aInfo, bool aFullParsing)
: mCurrentConfig(aInfo), mFullParsing(aFullParsing) {
if (CanBeInstantiated()) {
UpdateConfigFromExtraData(aInfo.mExtraData);
}
@ -51,9 +52,10 @@ class H264ChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
RESULT_DETAIL("Invalid H264 content"));
}
RefPtr<MediaByteBuffer> extra_data = aSample->mKeyframe || !mGotSPS
? H264::ExtractExtraData(aSample)
: nullptr;
RefPtr<MediaByteBuffer> extra_data =
aSample->mKeyframe || !mGotSPS || mFullParsing
? H264::ExtractExtraData(aSample)
: nullptr;
if (!H264::HasSPS(extra_data) && !H264::HasSPS(mCurrentConfig.mExtraData)) {
// We don't have inband data and the original config didn't contain a SPS.
@ -134,6 +136,7 @@ class H264ChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
VideoInfo mCurrentConfig;
uint32_t mStreamID = 0;
const bool mFullParsing;
bool mGotSPS = false;
RefPtr<TrackInfoSharedPtr> mTrackInfo;
RefPtr<MediaByteBuffer> mPreviousExtraData;
@ -222,7 +225,9 @@ MediaChangeMonitor::MediaChangeMonitor(PlatformDecoderModule* aPDM,
mChangeMonitor = MakeUnique<VPXChangeMonitor>(mCurrentConfig);
} else {
MOZ_ASSERT(MP4Decoder::IsH264(mCurrentConfig.mMimeType));
mChangeMonitor = MakeUnique<H264ChangeMonitor>(mCurrentConfig);
mChangeMonitor = MakeUnique<H264ChangeMonitor>(
mCurrentConfig,
mDecoderOptions.contains(CreateDecoderParams::Option::FullH264Parsing));
}
mLastError = CreateDecoder(aParams.mDiagnostics);
mInConstructor = false;

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

@ -55,7 +55,9 @@ int32_t WebrtcMediaDataDecoder::InitDecode(
mDecoder = mFactory->CreateDecoder(
{mInfo, mTaskQueue,
CreateDecoderParams::OptionSet(CreateDecoderParams::Option::LowLatency),
CreateDecoderParams::OptionSet(
CreateDecoderParams::Option::LowLatency,
CreateDecoderParams::Option::FullH264Parsing),
mTrackType, mImageContainer, knowsCompositor});
if (!mDecoder) {