You are not logged in.
Pages: 1
Resampling in Firefox is easy to disable:
$ cat firefox/dom/media/VideoUtils.cpp | grep DecideAudioPlaybackSampleRate -A27
uint32_t DecideAudioPlaybackSampleRate(const AudioInfo& aInfo,
bool aShouldResistFingerprinting) {
// bool resampling = StaticPrefs::media_resampling_enabled();
// uint32_t rate = 0;
// if (resampling) {
// 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). Cap to
// // 384kHz for good measure.
// rate = std::min<unsigned>(aInfo.mRate, 384000u);
// } else {
// // We will resample all data to match cubeb's preferred sampling rate.
// rate = CubebUtils::PreferredSampleRate(aShouldResistFingerprinting);
// if (rate > 768000) {
// // bogus rate, fall back to something else;
// rate = 48000;
// }
// }
// MOZ_DIAGNOSTIC_ASSERT(rate, "output rate can't be 0.");
// return rate;
return aInfo.mRate;
}
Firefox is easy to compile.
What is special about Chromium is that it has many resamplers inside:
[BUG] WebAudio always resampling to the output device sample rate, even if a different one is specified.
_https://issues.chromium.org/issues/40944208
Offline
_https://searchfox.org/firefox-main/source/dom/media/AudioConverter.cpp
#include "AudioConverter.h" #include <speex/speex_resampler.h>
Open the Firefox browser.
Type about:support into the address bar and press Enter.
The page will load, showing a detailed report of your Firefox setup.
To change the "Preferred Sample Rate" in about:support, you have to edit the source code with a text editor and recompile Firefox. For example:
_https://searchfox.org/firefox-main/source/dom/media/CubebUtils.cpp
$ cat firefox/dom/media/CubebUtils.cpp | grep PreferredSampleRate\(bool -A15
uint32_t PreferredSampleRate(bool aShouldResistFingerprinting) {
StaticMutexAutoLock lock(sMutex);
// if (sCubebForcedSampleRate) {
// return sCubebForcedSampleRate;
// }
// if (aShouldResistFingerprinting) {
// return 44100;
// }
// if (!InitPreferredSampleRate()) {
// return 44100;
// }
// MOZ_ASSERT(sPreferredSampleRate);
// return sPreferredSampleRate;
return 48000;
}
Offline
Pages: 1