Added
Link Here
|
0 |
- |
1 |
--- media/audio/alsa/audio_manager_alsa.cc.orig 2022-03-05 18:42:44 UTC |
|
|
2 |
+++ media/audio/alsa/audio_manager_alsa.cc |
3 |
@@ -89,7 +89,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType |
4 |
int card = -1; |
5 |
|
6 |
// Loop through the sound cards to get ALSA device hints. |
7 |
+#if !BUILDFLAG(IS_BSD) |
8 |
while (!wrapper_->CardNext(&card) && card >= 0) { |
9 |
+#endif |
10 |
void** hints = NULL; |
11 |
int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints); |
12 |
if (!error) { |
13 |
@@ -101,7 +103,9 @@ void AudioManagerAlsa::GetAlsaAudioDevices(StreamType |
14 |
DLOG(WARNING) << "GetAlsaAudioDevices: unable to get device hints: " |
15 |
<< wrapper_->StrError(error); |
16 |
} |
17 |
+#if !BUILDFLAG(IS_BSD) |
18 |
} |
19 |
+#endif |
20 |
} |
21 |
|
22 |
void AudioManagerAlsa::GetAlsaDevicesInfo(AudioManagerAlsa::StreamType type, |
23 |
@@ -184,7 +188,11 @@ bool AudioManagerAlsa::IsAlsaDeviceAvailable( |
24 |
// goes through software conversion if needed (e.g. incompatible |
25 |
// sample rate). |
26 |
// TODO(joi): Should we prefer "hw" instead? |
27 |
+#if BUILDFLAG(IS_BSD) |
28 |
+ static const char kDeviceTypeDesired[] = "plug"; |
29 |
+#else |
30 |
static const char kDeviceTypeDesired[] = "plughw"; |
31 |
+#endif |
32 |
return strncmp(kDeviceTypeDesired, device_name, |
33 |
base::size(kDeviceTypeDesired) - 1) == 0; |
34 |
} |
35 |
@@ -206,7 +214,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice( |
36 |
// Loop through the sound cards. |
37 |
// Don't use snd_device_name_hint(-1,..) since there is an access violation |
38 |
// inside this ALSA API with libasound.so.2.0.0. |
39 |
+#if !BUILDFLAG(IS_BSD) |
40 |
while (!wrapper_->CardNext(&card) && (card >= 0) && !has_device) { |
41 |
+#endif |
42 |
int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints); |
43 |
if (!error) { |
44 |
for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) { |
45 |
@@ -230,7 +240,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDevice( |
46 |
DLOG(WARNING) << "HasAnyAudioDevice: unable to get device hints: " |
47 |
<< wrapper_->StrError(error); |
48 |
} |
49 |
+#if !BUILDFLAG(IS_BSD) |
50 |
} |
51 |
+#endif |
52 |
|
53 |
return has_device; |
54 |
} |