diff options
author | Peter Simons <simons@cryp.to> | 2020-03-23 15:08:45 +0100 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2020-03-23 16:56:08 +0100 |
commit | 81b18c3711cd3ced9ad148ee6ba8c5f103709f12 (patch) | |
tree | 108e6a4a7e3ded5821e80f2b4022da0ecb6fd78e /pkgs/applications/networking/browsers | |
parent | 2a5ef17a6336a2f027a1adf66162b6de8344bb74 (diff) |
chromium: fix webrtc interaction with pulseaudio
The webrtc code suffered from a race condition when used with Pulseaudio. This lead to audio input breaking every couple of minutes during a webrtc session.
Diffstat (limited to 'pkgs/applications/networking/browsers')
-rw-r--r-- | pkgs/applications/networking/browsers/chromium/common.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/networking/browsers/chromium/patches/webrtc-pulse.patch | 61 |
2 files changed, 63 insertions, 0 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 255b399ef3da4..9d7f529dad675 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -151,6 +151,8 @@ let ] ++ optionals (useVaapi) [ # source: https://aur.archlinux.org/cgit/aur.git/tree/vaapi-fix.patch?h=chromium-vaapi ./patches/vaapi-fix.patch + # fix race condition in the interaction with pulseaudio + ./patches/webrtc-pulse.patch ]; postPatch = '' diff --git a/pkgs/applications/networking/browsers/chromium/patches/webrtc-pulse.patch b/pkgs/applications/networking/browsers/chromium/patches/webrtc-pulse.patch new file mode 100644 index 0000000000000..cf24e27041916 --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/patches/webrtc-pulse.patch @@ -0,0 +1,61 @@ +From 704dc99bd05a94eb61202e6127df94ddfd571e85 Mon Sep 17 00:00:00 2001 +From: Dale Curtis <dalecurtis@chromium.org> +Date: Mon, 02 Mar 2020 22:12:22 +0000 +Subject: [PATCH] Hold PulseAudio mainloop lock while querying input device info. + +a22cc23955cb3d58b7525c5103314226b3ce0137 moved this section out of +UpdateNativeAudioHardwareInfo(), but forgot to bring the lock along. + +R=guidou + +Bug: 1043040 +Change-Id: I5b17a2cf0ad55d61c0811db1dae7045af4a91370 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083814 +Commit-Queue: Dale Curtis <dalecurtis@chromium.org> +Commit-Queue: Guido Urdaneta <guidou@chromium.org> +Reviewed-by: Guido Urdaneta <guidou@chromium.org> +Auto-Submit: Dale Curtis <dalecurtis@chromium.org> +Cr-Commit-Position: refs/heads/master@{#746115} +--- + +diff --git a/media/audio/pulse/audio_manager_pulse.cc b/media/audio/pulse/audio_manager_pulse.cc +index 90e9317..829846f 100644 +--- a/media/audio/pulse/audio_manager_pulse.cc ++++ b/media/audio/pulse/audio_manager_pulse.cc +@@ -104,22 +104,27 @@ + + AudioParameters AudioManagerPulse::GetInputStreamParameters( + const std::string& device_id) { +- int user_buffer_size = GetUserBufferSize(); +- int buffer_size = +- user_buffer_size ? user_buffer_size : kDefaultInputBufferSize; +- + UpdateNativeAudioHardwareInfo(); +- auto* operation = pa_context_get_source_info_by_name( +- input_context_, default_source_name_.c_str(), DefaultSourceInfoCallback, +- this); +- WaitForOperationCompletion(input_mainloop_, operation, input_context_); ++ ++ { ++ AutoPulseLock auto_lock(input_mainloop_); ++ auto* operation = pa_context_get_source_info_by_name( ++ input_context_, default_source_name_.c_str(), DefaultSourceInfoCallback, ++ this); ++ WaitForOperationCompletion(input_mainloop_, operation, input_context_); ++ } + + // We don't want to accidentally open a monitor device, so return invalid +- // parameters for those. ++ // parameters for those. Note: The value of |default_source_is_monitor_| ++ // depends on the the call to pa_context_get_source_info_by_name() above. + if (device_id == AudioDeviceDescription::kDefaultDeviceId && + default_source_is_monitor_) { + return AudioParameters(); + } ++ ++ const int user_buffer_size = GetUserBufferSize(); ++ const int buffer_size = ++ user_buffer_size ? user_buffer_size : kDefaultInputBufferSize; + return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, + CHANNEL_LAYOUT_STEREO, + native_input_sample_rate_ ? native_input_sample_rate_ |