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.
This commit is contained in:
parent
2a5ef17a63
commit
81b18c3711
|
@ -151,6 +151,8 @@ let
|
||||||
] ++ optionals (useVaapi) [
|
] ++ optionals (useVaapi) [
|
||||||
# source: https://aur.archlinux.org/cgit/aur.git/tree/vaapi-fix.patch?h=chromium-vaapi
|
# source: https://aur.archlinux.org/cgit/aur.git/tree/vaapi-fix.patch?h=chromium-vaapi
|
||||||
./patches/vaapi-fix.patch
|
./patches/vaapi-fix.patch
|
||||||
|
# fix race condition in the interaction with pulseaudio
|
||||||
|
./patches/webrtc-pulse.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|
|
@ -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_
|
Loading…
Reference in New Issue