aboutsummaryrefslogtreecommitdiff
path: root/devel/electron38/files/patch-media_audio_alsa_audio__manager__alsa.cc
diff options
context:
space:
mode:
Diffstat (limited to 'devel/electron38/files/patch-media_audio_alsa_audio__manager__alsa.cc')
-rw-r--r--devel/electron38/files/patch-media_audio_alsa_audio__manager__alsa.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/devel/electron38/files/patch-media_audio_alsa_audio__manager__alsa.cc b/devel/electron38/files/patch-media_audio_alsa_audio__manager__alsa.cc
new file mode 100644
index 000000000000..dbdce170297d
--- /dev/null
+++ b/devel/electron38/files/patch-media_audio_alsa_audio__manager__alsa.cc
@@ -0,0 +1,54 @@
+--- media/audio/alsa/audio_manager_alsa.cc.orig 2025-08-26 20:49:50 UTC
++++ media/audio/alsa/audio_manager_alsa.cc
+@@ -103,7 +103,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType
+ int card = -1;
+
+ // Loop through the physical sound cards to get ALSA device hints.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && card >= 0) {
++#endif
+ void** hints = nullptr;
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+@@ -115,7 +117,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType
+ DLOG(WARNING) << "GetAlsaAudioDevices: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+ }
+
+ void AudioManagerAlsa::GetAlsaDevicesInfo(AudioManagerAlsa::StreamType type,
+@@ -199,7 +203,11 @@ bool AudioManagerAlsa::IsAlsaDeviceAvailable(AudioMana
+ // goes through software conversion if needed (e.g. incompatible
+ // sample rate).
+ // TODO(joi): Should we prefer "hw" instead?
++#if BUILDFLAG(IS_BSD)
++ static constexpr std::string_view kDeviceTypeDesired = "plug";
++#else
+ static constexpr std::string_view kDeviceTypeDesired = "plughw";
++#endif
+ return device_name.starts_with(kDeviceTypeDesired);
+ }
+
+@@ -250,7 +258,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice(
+ // Loop through the sound cards.
+ // Don't use snd_device_name_hint(-1,..) since there is an access violation
+ // inside this ALSA API with libasound.so.2.0.0.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && (card >= 0) && !has_device) {
++#endif
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+ const std::string_view unwanted_type =
+@@ -279,7 +289,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice(
+ DLOG(WARNING) << "HasAnyAudioDevice: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+
+ return has_device;
+ }