summaryrefslogtreecommitdiffstats
path: root/media/libcubeb/0001-disable-aaudio-before-android-31.patch
blob: 36519edcb259263cb866125ea19a60e895fb0623 (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
diff --git a/src/cubeb_aaudio.cpp b/media/libcubeb/src/cubeb_aaudio.cpp
--- a/src/cubeb_aaudio.cpp
+++ b/src/cubeb_aaudio.cpp
@@ -6,16 +6,17 @@
  */
 #include "cubeb-internal.h"
 #include "cubeb/cubeb.h"
 #include "cubeb_android.h"
 #include "cubeb_log.h"
 #include "cubeb_resampler.h"
 #include "cubeb_triple_buffer.h"
 #include <aaudio/AAudio.h>
+#include <android/api-level.h>
 #include <atomic>
 #include <cassert>
 #include <chrono>
 #include <condition_variable>
 #include <cstdint>
 #include <cstring>
 #include <dlfcn.h>
 #include <inttypes.h>
@@ -1700,16 +1701,19 @@ const static struct cubeb_ops aaudio_ops
     /*.stream_get_current_device =*/nullptr,
     /*.stream_device_destroy =*/nullptr,
     /*.stream_register_device_changed_callback =*/nullptr,
     /*.register_device_collection_changed =*/nullptr};
 
 extern "C" /*static*/ int
 aaudio_init(cubeb ** context, char const * /* context_name */)
 {
+  if (android_get_device_api_level() <= 30) {
+    return CUBEB_ERROR;
+  }
   // load api
   void * libaaudio = nullptr;
 #ifndef DISABLE_LIBAAUDIO_DLOPEN
   libaaudio = dlopen("libaaudio.so", RTLD_NOW);
   if (!libaaudio) {
     return CUBEB_ERROR;
   }