mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1812120 - Disable the AAudio backend when running on Android <= 30. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D168979
This commit is contained in:
parent
d356265137
commit
840cce01a4
51
media/libcubeb/0001-disable-aaudio-before-android-31.patch
Normal file
51
media/libcubeb/0001-disable-aaudio-before-android-31.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# HG changeset patch
|
||||||
|
# User Paul Adenot <paul@paul.cx>
|
||||||
|
# Date 1675704257 -3600
|
||||||
|
# Mon Feb 06 18:24:17 2023 +0100
|
||||||
|
# Node ID af331fb1ade15fff3f042f7881c12fdca6d86349
|
||||||
|
# Parent 56d3f31673a0d096e34564b0734d202a89d2ba47
|
||||||
|
Bug 1812120 - Disable the AAudio backend when running on Android <= 30. r?kinetik
|
||||||
|
|
||||||
|
Differential Revision: https://phabricator.services.mozilla.com/D168979
|
||||||
|
|
||||||
|
diff --git a/media/libcubeb/src/cubeb_aaudio.cpp b/media/libcubeb/src/cubeb_aaudio.cpp
|
||||||
|
--- a/media/libcubeb/src/cubeb_aaudio.cpp
|
||||||
|
+++ b/media/libcubeb/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 <cstring>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
@@ -1544,16 +1545,19 @@ const static struct cubeb_ops aaudio_ops
|
||||||
|
/*.stream_get_current_device =*/NULL,
|
||||||
|
/*.stream_device_destroy =*/NULL,
|
||||||
|
/*.stream_register_device_changed_callback =*/NULL,
|
||||||
|
/*.register_device_collection_changed =*/NULL};
|
||||||
|
|
||||||
|
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 = NULL;
|
||||||
|
#ifndef DISABLE_LIBAAUDIO_DLOPEN
|
||||||
|
libaaudio = dlopen("libaaudio.so", RTLD_NOW);
|
||||||
|
if (!libaaudio) {
|
||||||
|
return CUBEB_ERROR;
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@
|
|||||||
#include "cubeb_resampler.h"
|
#include "cubeb_resampler.h"
|
||||||
#include "cubeb_triple_buffer.h"
|
#include "cubeb_triple_buffer.h"
|
||||||
#include <aaudio/AAudio.h>
|
#include <aaudio/AAudio.h>
|
||||||
|
#include <android/api-level.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@ -1549,6 +1550,9 @@ const static struct cubeb_ops aaudio_ops = {
|
|||||||
extern "C" /*static*/ int
|
extern "C" /*static*/ int
|
||||||
aaudio_init(cubeb ** context, char const * /* context_name */)
|
aaudio_init(cubeb ** context, char const * /* context_name */)
|
||||||
{
|
{
|
||||||
|
if (android_get_device_api_level() <= 30) {
|
||||||
|
return CUBEB_ERROR;
|
||||||
|
}
|
||||||
// load api
|
// load api
|
||||||
void * libaaudio = NULL;
|
void * libaaudio = NULL;
|
||||||
#ifndef DISABLE_LIBAAUDIO_DLOPEN
|
#ifndef DISABLE_LIBAAUDIO_DLOPEN
|
||||||
|
Loading…
Reference in New Issue
Block a user