The officially official Devuan Forum!

You are not logged in.

#1 2025-10-06 17:20:59

igorzwx
Member
Registered: 2024-05-06
Posts: 324  

How to disable resamplig in Firefox

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

Board footer