From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/media/VideoUtils.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'dom/media/VideoUtils.cpp') diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index 90057f7c83..24b1f0dd59 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -188,12 +188,13 @@ uint32_t DecideAudioPlaybackSampleRate(const AudioInfo& aInfo, rate = 48000; } else if (aInfo.mRate >= 44100) { // The original rate is of good quality and we want to minimize unecessary - // resampling, so we let cubeb decide how to resample (if needed). - rate = aInfo.mRate; + // resampling, so we let cubeb decide how to resample (if needed). Cap to + // 384kHz for good measure. + rate = std::min(aInfo.mRate, 384000u); } else { // We will resample all data to match cubeb's preferred sampling rate. rate = CubebUtils::PreferredSampleRate(aShouldResistFingerprinting); - if (rate > 384000) { + if (rate > 768000) { // bogus rate, fall back to something else; rate = 48000; } -- cgit v1.2.3