Bug 1848518 - Update libcubeb to revision 3f86a. r=cubeb-reviewers,kinetik

Differential Revision: https://phabricator.services.mozilla.com/D186860
This commit is contained in:
Paul Adenot 2023-08-30 16:12:55 +00:00
Родитель 507057f1b2
Коммит ece3734ac7
6 изменённых файлов: 413 добавлений и 254 удалений

Просмотреть файл

@ -9,8 +9,8 @@ origin:
description: "Cross platform audio library"
url: https://github.com/mozilla/cubeb
license: ISC
release: ac8474a5929e9de3bce84f16f8c589240eb9f7c4 (2023-08-03T12:13:06Z).
revision: ac8474a5929e9de3bce84f16f8c589240eb9f7c4
release: 3f86a06fcee0ee738db8d0747bf291df8d12ef07 (2023-08-25T18:09:58Z).
revision: 3f86a06fcee0ee738db8d0747bf291df8d12ef07
vendoring:
url: https://github.com/mozilla/cubeb

Просмотреть файл

@ -19,7 +19,7 @@ output_latency_function *
cubeb_output_latency_load_method(int version)
{
output_latency_function * ol = NULL;
ol = calloc(1, sizeof(output_latency_function));
ol = (output_latency_function *)calloc(1, sizeof(output_latency_function));
ol->version = version;
@ -61,6 +61,8 @@ cubeb_output_latency_unload_method(output_latency_function * ol)
free(ol);
}
extern "C" {
uint32_t
cubeb_get_output_latency(output_latency_function * ol)
{
@ -72,5 +74,6 @@ cubeb_get_output_latency(output_latency_function * ol)
return cubeb_get_output_latency_from_media_library(ol->from_lib);
}
}
#endif // _CUBEB_OUTPUT_LATENCY_H_

Просмотреть файл

@ -1,9 +1,15 @@
#include <cassert>
#include <cstdint>
#include <dlfcn.h>
#include <stdlib.h>
#ifndef _CUBEB_MEDIA_LIBRARY_H_
#define _CUBEB_MEDIA_LIBRARY_H_
typedef int32_t (*get_output_latency_ptr)(uint32_t * latency, int stream_type);
struct media_lib {
void * libmedia;
int32_t (*get_output_latency)(uint32_t * latency, int stream_type);
get_output_latency_ptr get_output_latency;
};
typedef struct media_lib media_lib;
@ -11,30 +17,30 @@ typedef struct media_lib media_lib;
media_lib *
cubeb_load_media_library()
{
media_lib ml = {0};
media_lib ml = {};
ml.libmedia = dlopen("libmedia.so", RTLD_LAZY);
if (!ml.libmedia) {
return NULL;
return nullptr;
}
// Get the latency, in ms, from AudioFlinger. First, try the most recent
// signature. status_t AudioSystem::getOutputLatency(uint32_t* latency,
// audio_stream_type_t streamType)
ml.get_output_latency = dlsym(
ml.get_output_latency = (get_output_latency_ptr)dlsym(
ml.libmedia,
"_ZN7android11AudioSystem16getOutputLatencyEPj19audio_stream_type_t");
if (!ml.get_output_latency) {
// In case of failure, try the signature from legacy version.
// status_t AudioSystem::getOutputLatency(uint32_t* latency, int streamType)
ml.get_output_latency =
dlsym(ml.libmedia, "_ZN7android11AudioSystem16getOutputLatencyEPji");
ml.get_output_latency = (get_output_latency_ptr)dlsym(
ml.libmedia, "_ZN7android11AudioSystem16getOutputLatencyEPji");
if (!ml.get_output_latency) {
return NULL;
return nullptr;
}
}
media_lib * rv = NULL;
rv = calloc(1, sizeof(media_lib));
media_lib * rv = nullptr;
rv = (media_lib *)calloc(1, sizeof(media_lib));
assert(rv);
*rv = ml;
return rv;

Просмотреть файл

@ -3,6 +3,10 @@
typedef struct cubeb_jni cubeb_jni;
#ifdef __cplusplus
extern "C" {
#endif
cubeb_jni *
cubeb_jni_init();
int
@ -10,4 +14,8 @@ cubeb_get_output_latency_from_jni(cubeb_jni * cubeb_jni_ptr);
void
cubeb_jni_destroy(cubeb_jni * cubeb_jni_ptr);
#ifdef __cplusplus
};
#endif
#endif // _CUBEB_JNI_H_

Просмотреть файл

@ -11,7 +11,6 @@
#include "cubeb_resampler.h"
#include "cubeb_triple_buffer.h"
#include <aaudio/AAudio.h>
#include <android/api-level.h>
#include <atomic>
#include <cassert>
#include <chrono>
@ -1705,9 +1704,6 @@ const static struct cubeb_ops aaudio_ops = {
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

Разница между файлами не показана из-за своего большого размера Загрузить разницу