summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <robert@openbsd.org>2022-03-05 23:01:23 +0100
committerRene Ladan <rene@FreeBSD.org>2022-03-05 23:04:29 +0100
commit9c9e497796708b460147da46bbc00e6e5c8df7e5 (patch)
treed3f26b3480c84b051297fc647966cd383167d04e
parentx11/wob: update to 0.13 (diff)
www/chromium: fix audio playback with ALSA
PR: 262365 Reported by: o.hushchenkov@gmail.com Tested by: o.hushchenkov@gmail.com (cherry picked from commit fd50b0334df1c720befc62ae613bfa8862efb336)
-rw-r--r--www/chromium/Makefile1
-rw-r--r--www/chromium/files/patch-media_audio_alsa_audio__manager__alsa.cc54
2 files changed, 55 insertions, 0 deletions
diff --git a/www/chromium/Makefile b/www/chromium/Makefile
index b7ee68b405cf..e9c5492b11d5 100644
--- a/www/chromium/Makefile
+++ b/www/chromium/Makefile
@@ -2,6 +2,7 @@
PORTNAME= chromium
PORTVERSION= 99.0.4844.51
+PORTREVISION= 1
CATEGORIES= www
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/ \
https://nerd.hu/distfiles/:fonts
diff --git a/www/chromium/files/patch-media_audio_alsa_audio__manager__alsa.cc b/www/chromium/files/patch-media_audio_alsa_audio__manager__alsa.cc
new file mode 100644
index 000000000000..deb7ec59d8a0
--- /dev/null
+++ b/www/chromium/files/patch-media_audio_alsa_audio__manager__alsa.cc
@@ -0,0 +1,54 @@
+--- media/audio/alsa/audio_manager_alsa.cc.orig 2022-03-05 18:42:44 UTC
++++ media/audio/alsa/audio_manager_alsa.cc
+@@ -89,7 +89,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType
+ int card = -1;
+
+ // Loop through the sound cards to get ALSA device hints.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && card >= 0) {
++#endif
+ void** hints = NULL;
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+@@ -101,7 +103,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,
+@@ -184,7 +188,11 @@ bool AudioManagerAlsa::IsAlsaDeviceAvailable(
+ // goes through software conversion if needed (e.g. incompatible
+ // sample rate).
+ // TODO(joi): Should we prefer "hw" instead?
++#if BUILDFLAG(IS_BSD)
++ static const char kDeviceTypeDesired[] = "plug";
++#else
+ static const char kDeviceTypeDesired[] = "plughw";
++#endif
+ return strncmp(kDeviceTypeDesired, device_name,
+ base::size(kDeviceTypeDesired) - 1) == 0;
+ }
+@@ -206,7 +214,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) {
+ for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) {
+@@ -230,7 +240,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice(
+ DLOG(WARNING) << "HasAnyAudioDevice: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+
+ return has_device;
+ }