summaryrefslogtreecommitdiff
path: root/repo/qt5-qtwebengine/sndio.patch
blob: 771e63043e04641342d72751b5d5efc72a85df0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from void-packages, 0101,0102-sndio.patch
--- a/src/core/configure.json	2020-03-24 10:16:30.000000000 +0100
+++ -	2020-04-06 14:28:00.591236926 +0200
@@ -21,6 +21,7 @@
             "webengine-printing-and-pdf": "boolean",
             "webengine-proprietary-codecs": "boolean",
             "webengine-pulseaudio": "boolean",
+            "webengine-sndio": "boolean",
             "webengine-spellchecker": "boolean",
             "webengine-native-spellchecker": "boolean",
             "webengine-extensions": "boolean",
@@ -31,6 +32,7 @@
             "webengine-kerberos": "boolean",
             "alsa": { "type": "boolean", "name": "webengine-alsa" },
             "pulseaudio": { "type": "boolean", "name": "webengine-pulseaudio" },
+            "sndio": { "type": "boolean", "name": "webengine-sndio" },
             "ffmpeg": { "type": "enum", "name": "webengine-system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
             "opus": { "type": "enum", "name": "webengine-system-opus", "values": { "system": "yes", "qt": "no" } },
             "webp": { "type": "enum", "name": "webengine-system-libwebp", "values": { "system": "yes", "qt": "no" } },
@@ -68,7 +70,13 @@
             "sources": [
                 { "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" }
             ]
-        }
+        },
+        "sndio": {
+            "label": "sndio",
+            "sources": [
+                { "type": "pkgConfig", "args": "libsndio >= 1.5.0 libsndio" }
+            ]
+	}
     },
     "tests" : {
         "webengine-host-compiler": {
@@ -136,6 +144,10 @@
             "condition": "libs.webengine-pulseaudio",
             "output": [ "privateFeature" ]
         },
+	"webengine-sndio": {
+            "label": "Use sndio",
+            "output": [ "privateFeature" ]
+        },
         "webengine-pepper-plugins": {
             "label": "Pepper Plugins",
             "purpose": "Enables use of Pepper Flash plugins.",
@@ -308,6 +320,11 @@
                     "condition": "config.unix"
                 },
                 {
+                   "type": "feature",
+                   "args": "webengine-sndio",
+                   "condition": "config.unix"
+                },
+                {
                     "type": "feature",
                     "args": "webengine-sanitizer",
                     "condition": "config.sanitizer"
--- a/src/3rdparty/chromium/media/audio/linux/audio_manager_linux.cc
+++ b/src/3rdparty/chromium/media/audio/linux/audio_manager_linux.cc
@@ -20,6 +20,10 @@
 #include "media/audio/pulse/audio_manager_pulse.h"
 #include "media/audio/pulse/pulse_util.h"
 #endif
+#if defined(USE_SNDIO)
+#include <sndio.h>
+#include "media/audio/openbsd/audio_manager_openbsd.h"
+#endif
 
 namespace media {
 
@@ -27,7 +31,8 @@ enum LinuxAudioIO {
   kPulse,
   kAlsa,
   kCras,
-  kAudioIOMax = kCras  // Must always be equal to largest logged entry.
+  kSndio,
+  kAudioIOMax = kSndio  // Must always be equal to largest logged entry.
 };
 
 std::unique_ptr<media::AudioManager> CreateAudioManager(
@@ -41,6 +46,17 @@ std::unique_ptr<media::AudioManager> CreateAudioManager(
   }
 #endif
 
+#if defined(USE_SNDIO)
+  struct sio_hdl * hdl = NULL;
+  if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) {
+    sio_close(hdl);
+    UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1);
+    return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),
+                                               audio_log_factory);
+  }
+  DVLOG(1) << "Sndio is not available on the OS";
+#endif
+
 #if defined(USE_PULSEAUDIO)
   pa_threaded_mainloop* pa_mainloop = nullptr;
   pa_context* pa_context = nullptr;
--- a/src/3rdparty/chromium/media/BUILD.gn	2020-03-24 10:16:30.000000000 +0100
+++ -	2020-04-06 14:32:27.960817513 +0200
@@ -65,6 +65,9 @@
   if (use_cras) {
     defines += [ "USE_CRAS" ]
   }
+  if (use_sndio) {
+    defines += [ "USE_SNDIO" ]
+  }
 }
 
 # Internal grouping of the configs necessary to support sub-folders having their
--- a/src/3rdparty/chromium/media/media_options.gni	2020-03-24 10:16:30.000000000 +0100
+++ -	2020-04-06 14:29:22.958630783 +0200
@@ -114,6 +114,9 @@
   # Enables runtime selection of ALSA library for audio.
   use_alsa = false
 
+  # Enables runtime selection of sndio library for audio.
+  use_sndio = false
+
   # Alsa should be used on non-Android, non-Mac POSIX systems.
   # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
   if (is_posix && !is_android && !is_mac &&
--- a/src/3rdparty/chromium/media/audio/BUILD.gn	2021-02-23 16:36:59.000000000 +0100
+++ -	2021-03-07 22:00:34.889682069 +0100
@@ -238,6 +238,17 @@
     sources += [ "linux/audio_manager_linux.cc" ]
   }
 
+  if (use_sndio) {
+    libs += [ "sndio" ]
+    sources += [
+      "openbsd/audio_manager_openbsd.cc",
+      "sndio/sndio_input.cc",
+      "sndio/sndio_input.h",
+      "sndio/sndio_output.cc",
+      "sndio/sndio_output.h"
+    ]
+  }
+
   if (use_alsa) {
     libs += [ "asound" ]
     sources += [