From da4c7e7ed675c3bf405668739c3012d140856109 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:42 +0200 Subject: Adding upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/media/webcodecs/VideoEncoder.cpp | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'dom/media/webcodecs/VideoEncoder.cpp') diff --git a/dom/media/webcodecs/VideoEncoder.cpp b/dom/media/webcodecs/VideoEncoder.cpp index f593f70c77..5407e917b6 100644 --- a/dom/media/webcodecs/VideoEncoder.cpp +++ b/dom/media/webcodecs/VideoEncoder.cpp @@ -120,11 +120,12 @@ VideoEncoderConfigInternal::VideoEncoderConfigInternal( mContentHint(OptionalToMaybe(aConfig.mContentHint)), mAvc(OptionalToMaybe(aConfig.mAvc)) {} -nsString VideoEncoderConfigInternal::ToString() const { - nsString rv; +nsCString VideoEncoderConfigInternal::ToString() const { + nsCString rv; - rv.AppendPrintf("Codec: %s, [%" PRIu32 "x%" PRIu32 "],", - NS_ConvertUTF16toUTF8(mCodec).get(), mWidth, mHeight); + rv.AppendLiteral("Codec: "); + rv.Append(NS_ConvertUTF16toUTF8(mCodec)); + rv.AppendPrintf(" [%" PRIu32 "x%" PRIu32 "],", mWidth, mHeight); if (mDisplayWidth.isSome()) { rv.AppendPrintf(", display[%" PRIu32 "x%" PRIu32 "]", mDisplayWidth.value(), mDisplayHeight.value()); @@ -194,20 +195,19 @@ bool VideoEncoderConfigInternal::CanReconfigure( } EncoderConfig VideoEncoderConfigInternal::ToEncoderConfig() const { - MediaDataEncoder::Usage usage; + Usage usage; if (mLatencyMode == LatencyMode::Quality) { - usage = MediaDataEncoder::Usage::Record; + usage = Usage::Record; } else { - usage = MediaDataEncoder::Usage::Realtime; + usage = Usage::Realtime; } - MediaDataEncoder::HardwarePreference hwPref = - MediaDataEncoder::HardwarePreference::None; + HardwarePreference hwPref = HardwarePreference::None; if (mHardwareAcceleration == mozilla::dom::HardwareAcceleration::Prefer_hardware) { - hwPref = MediaDataEncoder::HardwarePreference::RequireHardware; + hwPref = HardwarePreference::RequireHardware; } else if (mHardwareAcceleration == mozilla::dom::HardwareAcceleration::Prefer_software) { - hwPref = MediaDataEncoder::HardwarePreference::RequireSoftware; + hwPref = HardwarePreference::RequireSoftware; } CodecType codecType; auto maybeCodecType = CodecStringToCodecType(mCodec); @@ -236,19 +236,19 @@ EncoderConfig VideoEncoderConfigInternal::ToEncoderConfig() const { } } uint8_t numTemporalLayers = 1; - MediaDataEncoder::ScalabilityMode scalabilityMode; + ScalabilityMode scalabilityMode; if (mScalabilityMode) { if (mScalabilityMode->EqualsLiteral("L1T2")) { - scalabilityMode = MediaDataEncoder::ScalabilityMode::L1T2; + scalabilityMode = ScalabilityMode::L1T2; numTemporalLayers = 2; } else if (mScalabilityMode->EqualsLiteral("L1T3")) { - scalabilityMode = MediaDataEncoder::ScalabilityMode::L1T3; + scalabilityMode = ScalabilityMode::L1T3; numTemporalLayers = 3; } else { - scalabilityMode = MediaDataEncoder::ScalabilityMode::None; + scalabilityMode = ScalabilityMode::None; } } else { - scalabilityMode = MediaDataEncoder::ScalabilityMode::None; + scalabilityMode = ScalabilityMode::None; } // Only for vp9, not vp8 if (codecType == CodecType::VP9) { @@ -278,8 +278,8 @@ EncoderConfig VideoEncoderConfigInternal::ToEncoderConfig() const { AssertedCast(mFramerate.refOr(0.f)), 0, mBitrate.refOr(0), mBitrateMode == VideoEncoderBitrateMode::Constant - ? MediaDataEncoder::BitrateMode::Constant - : MediaDataEncoder::BitrateMode::Variable, + ? mozilla::BitrateMode::Constant + : mozilla::BitrateMode::Variable, hwPref, scalabilityMode, specific); } already_AddRefed @@ -558,7 +558,7 @@ already_AddRefed VideoEncoder::IsConfigSupported( } RefPtr VideoEncoder::EncodedDataToOutputType( - nsIGlobalObject* aGlobalObject, RefPtr& aData) { + nsIGlobalObject* aGlobalObject, const RefPtr& aData) { AssertIsOnOwningThread(); MOZ_RELEASE_ASSERT(aData->mType == MediaData::Type::RAW_DATA); @@ -591,8 +591,8 @@ VideoDecoderConfigInternal VideoEncoder::EncoderConfigToDecoderConfig( Some(mOutputConfig.mWidth), /* aCodedWidth */ Some(init), /* aColorSpace */ aRawData->mExtraData && !aRawData->mExtraData->IsEmpty() - ? Some(aRawData->mExtraData) - : Nothing(), /* aDescription*/ + ? aRawData->mExtraData.forget() + : nullptr, /* aDescription*/ Maybe(mOutputConfig.mDisplayHeight), /* aDisplayAspectHeight*/ Maybe(mOutputConfig.mDisplayWidth), /* aDisplayAspectWidth */ mOutputConfig.mHardwareAcceleration, /* aHardwareAcceleration */ -- cgit v1.2.3