diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 9dfa20b4eec9..103e327ab8d9 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -377,13 +377,11 @@ void MediaFormatReader::DecoderFactory::DoCreateDecoder(Data& aData) { switch (aData.mTrack) { case TrackInfo::kAudioTrack: { - bool lowLatency = ownerData.GetCurrentInfo()->GetAsAudioInfo()->mIsLive; p = platform->CreateDecoder( {*ownerData.GetCurrentInfo()->GetAsAudioInfo(), mOwner->mCrashHelper, CreateDecoderParams::UseNullDecoder(ownerData.mIsNullDecode), TrackInfo::kAudioTrack, std::move(onWaitingForKeyEvent), - mOwner->mMediaEngineId, mOwner->mTrackingId, - OptionSet(lowLatency ? Option::LowLatency : Option::Default)}); + mOwner->mMediaEngineId, mOwner->mTrackingId}); break; } @@ -392,7 +390,7 @@ void MediaFormatReader::DecoderFactory::DoCreateDecoder(Data& aData) { // decoding, so specify LAYERS_NONE if we want to forcibly disable it. using Option = CreateDecoderParams::Option; using OptionSet = CreateDecoderParams::OptionSet; - bool lowLatency = ownerData.GetCurrentInfo()->GetAsVideoInfo()->mIsLive; + p = platform->CreateDecoder( {*ownerData.GetCurrentInfo()->GetAsVideoInfo(), mOwner->mKnowsCompositor, mOwner->GetImageContainer(), @@ -403,7 +401,6 @@ void MediaFormatReader::DecoderFactory::DoCreateDecoder(Data& aData) { OptionSet(ownerData.mHardwareDecodingDisabled ? Option::HardwareDecoderNotAllowed : Option::Default), - OptionSet(lowLatency ? Option::LowLatency : Option::Default), mOwner->mMediaEngineId, mOwner->mTrackingId}); break; } diff --git a/dom/media/MediaInfo.h b/dom/media/MediaInfo.h index 23449289a6c4..0b0fdcea8f0a 100644 --- a/dom/media/MediaInfo.h +++ b/dom/media/MediaInfo.h @@ -283,10 +283,6 @@ class TrackInfo { // rendered directly by non-gecko components. bool mIsRenderedExternally; - // True if the track represent live media - // This allows configuring decoders in low-latency mode. - bool mIsLive = false; - virtual AudioInfo* GetAsAudioInfo() { return nullptr; } virtual VideoInfo* GetAsVideoInfo() { return nullptr; } virtual TextInfo* GetAsTextInfo() { return nullptr; } diff --git a/dom/media/mp4/DecoderData.cpp b/dom/media/mp4/DecoderData.cpp index de3049272762..a197c968a4e1 100644 --- a/dom/media/mp4/DecoderData.cpp +++ b/dom/media/mp4/DecoderData.cpp @@ -8,7 +8,6 @@ #include "DecoderData.h" #include "mozilla/ArrayUtils.h" #include "mozilla/EndianUtils.h" -#include "mozilla/StaticPrefs_media.h" #include "mozilla/Telemetry.h" #include "VideoUtils.h" #include "MP4Metadata.h" @@ -266,12 +265,8 @@ MediaResult MP4AudioInfo::Update(const Mp4parseTrackInfo* aTrack, if (aTrack->duration > TimeUnit::MaxTicks()) { mDuration = TimeUnit::FromInfinity(); } else { - if (aTrack->duration) { - mDuration = - TimeUnit(AssertedCast(aTrack->duration), aTrack->time_scale); - } else { - mIsLive = true; - } + mDuration = + TimeUnit(AssertedCast(aTrack->duration), aTrack->time_scale); } mMediaTime = TimeUnit(aTrack->media_time, aTrack->time_scale); mTrackId = aTrack->track_id; @@ -338,12 +333,8 @@ MediaResult MP4VideoInfo::Update(const Mp4parseTrackInfo* track, if (track->duration > TimeUnit::MaxTicks()) { mDuration = TimeUnit::FromInfinity(); } else { - if (track->duration > 0) { - mDuration = - TimeUnit(AssertedCast(track->duration), track->time_scale); - } else { - mIsLive = true; - } + mDuration = + TimeUnit(AssertedCast(track->duration), track->time_scale); } mMediaTime = TimeUnit(track->media_time, track->time_scale); mDisplay.width = AssertedCast(video->display_width); @@ -354,7 +345,6 @@ MediaResult MP4VideoInfo::Update(const Mp4parseTrackInfo* track, Mp4parseByteData extraData = video->sample_info[0].extra_data; // If length is 0 we append nothing mExtraData->AppendElements(extraData.data, extraData.length); - mIsLive |= StaticPrefs::media_low_latency_decoding_force_enabled(); return NS_OK; } diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index 4e4e70d8fdb9..422f5aabece1 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -288,7 +288,7 @@ MediaResult WMFVideoMFTManager::InitInternal() { attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads, WMFDecoderModule::GetNumDecoderThreads()); bool lowLatency = StaticPrefs::media_wmf_low_latency_enabled(); - if (mLowLatency && lowLatency) { + if (mLowLatency || lowLatency) { hr = attr->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE); if (SUCCEEDED(hr)) { LOG("Enabling Low Latency Mode"); diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index 524c80be0dee..1681640fd311 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -17,7 +17,6 @@ #include "gfxUtils.h" #include "mozilla/EndianUtils.h" #include "mozilla/SharedThreadPool.h" -#include "mozilla/StaticPrefs_media.h" #include "MediaDataDemuxer.h" #include "nsAutoRef.h" #include "NesteggPacketHolder.h" @@ -382,28 +381,9 @@ nsresult WebMDemuxer::ReadMetadata() { uint64_t duration = 0; r = nestegg_duration(context, &duration); if (!r) { - // It's technically possible to have duration be > INT64_MAX here. - // When that's the case, use a lower resolution TimeUnit - if (duration <= std::numeric_limits::max()) { - mInfo.mVideo.mDuration = - TimeUnit::FromNanoseconds(AssertedCast(duration)); - } else { - mInfo.mVideo.mDuration = - TimeUnit(AssertedCast(duration / 1000), USECS_PER_S); - } - } else { - mInfo.mVideo.mDuration = TimeUnit::FromInfinity(); - mInfo.mVideo.mIsLive = true; + mInfo.mVideo.mDuration = TimeUnit::FromNanoseconds(duration); } - - mInfo.mVideo.mIsLive |= - StaticPrefs::media_low_latency_decoding_force_enabled(); - - WEBM_DEBUG("WebM video track duration: %s\n", - mInfo.mVideo.mDuration.IsValid() - ? mInfo.mVideo.mDuration.ToString().get() - : "live"); - + WEBM_DEBUG("stream duration: %lf\n", mInfo.mVideo.mDuration.ToSeconds()); mInfo.mVideo.mCrypto = GetTrackCrypto(TrackInfo::kVideoTrack, track); if (mInfo.mVideo.mCrypto.IsEncrypted()) { MOZ_ASSERT(mInfo.mVideo.mCrypto.mCryptoScheme == CryptoScheme::Cenc, @@ -488,27 +468,10 @@ nsresult WebMDemuxer::ReadMetadata() { uint64_t duration = 0; r = nestegg_duration(context, &duration); if (!r) { - // It's technically possible to have duration be > INT64_MAX here. - // When that's the case, use a lower resolution TimeUnit - if (duration <= std::numeric_limits::max()) { - mInfo.mAudio.mDuration = - TimeUnit::FromNanoseconds(AssertedCast(duration)); - } else { - mInfo.mAudio.mDuration = - TimeUnit(AssertedCast(duration / 1000), USECS_PER_S); - } - } else { - mInfo.mAudio.mDuration = TimeUnit::FromInfinity(); - mInfo.mAudio.mIsLive = true; + mInfo.mAudio.mDuration = TimeUnit::FromNanoseconds(duration); + WEBM_DEBUG("audio track duration: %lf", + mInfo.mAudio.mDuration.ToSeconds()); } - - mInfo.mAudio.mIsLive |= - StaticPrefs::media_low_latency_decoding_force_enabled(); - - WEBM_DEBUG("WebM audio track duration: %s\n", - mInfo.mAudio.mDuration.IsValid() - ? mInfo.mAudio.mDuration.ToString().get() - : "live"); mInfo.mAudio.mCrypto = GetTrackCrypto(TrackInfo::kAudioTrack, track); if (mInfo.mAudio.mCrypto.IsEncrypted()) { MOZ_ASSERT(mInfo.mAudio.mCrypto.mCryptoScheme == CryptoScheme::Cenc, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 795f4a8d6c44..65482b99ff6a 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -10117,12 +10117,6 @@ value: false mirror: always -# Configure all decoders to use low-latency mode. -- name: media.low-latency-decoding.force-enabled - type: RelaxedAtomicBool - value: false - mirror: always - #ifdef MOZ_WMF - name: media.wmf.enabled