зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1789547 - Update libcubeb to revision 4783607e. r=cubeb-reviewers,kinetik
Differential Revision: https://phabricator.services.mozilla.com/D156696
This commit is contained in:
Родитель
abade6347e
Коммит
9cab310f15
|
@ -9,8 +9,8 @@ origin:
|
|||
description: "Cross platform audio library"
|
||||
url: https://github.com/mozilla/cubeb
|
||||
license: ISC
|
||||
release: commit 708f52cccffe69ed1d65b52903237c990db860a9 (2022-04-13T15:02:09Z).
|
||||
revision: 708f52cccffe69ed1d65b52903237c990db860a9
|
||||
release: 4783607ecc09e9493677a9c4e3db95f78d87409a (2022-09-06T12:38:56Z).
|
||||
revision: 4783607ecc09e9493677a9c4e3db95f78d87409a
|
||||
|
||||
vendoring:
|
||||
url: https://github.com/mozilla/cubeb
|
||||
|
|
|
@ -463,10 +463,11 @@ aaudio_destroy(cubeb * ctx)
|
|||
if (ctx->state.notifier.joinable()) {
|
||||
ctx->state.notifier.join();
|
||||
}
|
||||
|
||||
#ifndef DISABLE_LIBAAUDIO_DLOPEN
|
||||
if (ctx->libaaudio) {
|
||||
dlclose(ctx->libaaudio);
|
||||
}
|
||||
#endif
|
||||
delete ctx;
|
||||
}
|
||||
|
||||
|
|
|
@ -957,11 +957,11 @@ alsa_destroy(cubeb * ctx)
|
|||
WRAP(snd_config_delete)(ctx->local_config);
|
||||
pthread_mutex_unlock(&cubeb_alsa_mutex);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_LIBASOUND_DLOPEN
|
||||
if (ctx->libasound) {
|
||||
dlclose(ctx->libasound);
|
||||
}
|
||||
|
||||
#endif
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
|
|
|
@ -788,10 +788,10 @@ cbjack_destroy(cubeb * context)
|
|||
|
||||
if (context->jack_client != NULL)
|
||||
WRAP(jack_client_close)(context->jack_client);
|
||||
|
||||
#ifndef DISABLE_LIBJACK_DLOPEN
|
||||
if (context->libjack)
|
||||
dlclose(context->libjack);
|
||||
|
||||
#endif
|
||||
free(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "cubeb_log.h"
|
||||
#include "cubeb_ringbuffer.h"
|
||||
#include "cubeb_tracing.h"
|
||||
#include <cstdarg>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
@ -69,10 +70,11 @@ public:
|
|||
void run()
|
||||
{
|
||||
std::thread([this]() {
|
||||
CUBEB_REGISTER_THREAD("cubeb_log");
|
||||
while (true) {
|
||||
cubeb_log_message msg;
|
||||
while (msg_queue.dequeue(&msg, 1)) {
|
||||
LOGV("%s", msg.get());
|
||||
LOG_INTERNAL_NO_FORMAT(CUBEB_LOG_NORMAL, "%s", msg.get());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
Sleep(CUBEB_LOG_BATCH_PRINT_INTERVAL_MS);
|
||||
|
@ -87,6 +89,7 @@ public:
|
|||
} while (remainder.tv_sec || remainder.tv_nsec);
|
||||
#endif
|
||||
}
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
}).detach();
|
||||
}
|
||||
// Tell the underlying queue the producer thread has changed, so it does not
|
||||
|
@ -123,7 +126,7 @@ cubeb_async_log(char const * fmt, ...)
|
|||
}
|
||||
|
||||
void
|
||||
cubeb_async_log_reset_threads()
|
||||
cubeb_async_log_reset_threads(void)
|
||||
{
|
||||
if (!g_cubeb_log_callback) {
|
||||
return;
|
||||
|
|
|
@ -35,7 +35,7 @@ extern cubeb_log_callback g_cubeb_log_callback PRINTF_FORMAT(1, 2);
|
|||
void
|
||||
cubeb_async_log(const char * fmt, ...);
|
||||
void
|
||||
cubeb_async_log_reset_threads();
|
||||
cubeb_async_log_reset_threads(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -44,6 +44,13 @@ cubeb_async_log_reset_threads();
|
|||
#define LOGV(msg, ...) LOG_INTERNAL(CUBEB_LOG_VERBOSE, msg, ##__VA_ARGS__)
|
||||
#define LOG(msg, ...) LOG_INTERNAL(CUBEB_LOG_NORMAL, msg, ##__VA_ARGS__)
|
||||
|
||||
#define LOG_INTERNAL_NO_FORMAT(level, fmt, ...) \
|
||||
do { \
|
||||
if (g_cubeb_log_callback && level <= g_cubeb_log_level) { \
|
||||
g_cubeb_log_callback(fmt, __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LOG_INTERNAL(level, fmt, ...) \
|
||||
do { \
|
||||
if (g_cubeb_log_callback && level <= g_cubeb_log_level) { \
|
||||
|
@ -52,11 +59,16 @@ cubeb_async_log_reset_threads();
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
/* Asynchronous verbose logging, to log in real-time callbacks. */
|
||||
/* Should not be used on android due to the use of global/static variables. */
|
||||
#define ALOGV(fmt, ...) \
|
||||
#define ALOG_INTERNAL(level, fmt, ...) \
|
||||
do { \
|
||||
if (level <= g_cubeb_log_level) { \
|
||||
cubeb_async_log(fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Asynchronous logging macros to log in real-time callbacks. */
|
||||
/* Should not be used on android due to the use of global/static variables. */
|
||||
#define ALOGV(msg, ...) ALOG_INTERNAL(CUBEB_LOG_VERBOSE, msg, ##__VA_ARGS__)
|
||||
#define ALOG(msg, ...) ALOG_INTERNAL(CUBEB_LOG_NORMAL, msg, ##__VA_ARGS__)
|
||||
|
||||
#endif // CUBEB_LOG
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
uint32_t to_keep = min_buffered_audio_frame(sample_rate);
|
||||
uint32_t available = samples_to_frames(internal_input_buffer.length());
|
||||
if (available > to_keep) {
|
||||
ALOGV("Dropping %u frames", available - to_keep);
|
||||
internal_input_buffer.pop(nullptr,
|
||||
frames_to_samples(available - to_keep));
|
||||
}
|
||||
|
@ -325,6 +326,7 @@ public:
|
|||
uint32_t available = samples_to_frames(resampling_in_buffer.length());
|
||||
uint32_t to_keep = min_buffered_audio_frame(source_rate);
|
||||
if (available > to_keep) {
|
||||
ALOGV("Dropping %u frames", available - to_keep);
|
||||
resampling_in_buffer.pop(nullptr, frames_to_samples(available - to_keep));
|
||||
}
|
||||
}
|
||||
|
@ -470,6 +472,7 @@ public:
|
|||
size_t available = samples_to_frames(delay_input_buffer.length());
|
||||
uint32_t to_keep = min_buffered_audio_frame(sample_rate);
|
||||
if (available > to_keep) {
|
||||
ALOGV("Dropping %u frames", available - to_keep);
|
||||
delay_input_buffer.pop(nullptr, frames_to_samples(available - to_keep));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ public:
|
|||
assert_correct_thread(producer_id);
|
||||
#endif
|
||||
|
||||
int rd_idx = read_index_.load(std::memory_order_relaxed);
|
||||
int wr_idx = write_index_.load(std::memory_order_relaxed);
|
||||
int rd_idx = read_index_.load(std::memory_order_acquire);
|
||||
|
||||
if (full_internal(rd_idx, wr_idx)) {
|
||||
return 0;
|
||||
|
@ -154,8 +154,8 @@ public:
|
|||
assert_correct_thread(consumer_id);
|
||||
#endif
|
||||
|
||||
int wr_idx = write_index_.load(std::memory_order_acquire);
|
||||
int rd_idx = read_index_.load(std::memory_order_relaxed);
|
||||
int wr_idx = write_index_.load(std::memory_order_acquire);
|
||||
|
||||
if (empty_internal(rd_idx, wr_idx)) {
|
||||
return 0;
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
}
|
||||
|
||||
read_index_.store(increment_index(rd_idx, to_read),
|
||||
std::memory_order_relaxed);
|
||||
std::memory_order_release);
|
||||
|
||||
return to_read;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
#endif
|
||||
return available_read_internal(
|
||||
read_index_.load(std::memory_order_relaxed),
|
||||
write_index_.load(std::memory_order_relaxed));
|
||||
write_index_.load(std::memory_order_acquire));
|
||||
}
|
||||
/**
|
||||
* Get the number of available elements for consuming.
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
assert_correct_thread(producer_id);
|
||||
#endif
|
||||
return available_write_internal(
|
||||
read_index_.load(std::memory_order_relaxed),
|
||||
read_index_.load(std::memory_order_acquire),
|
||||
write_index_.load(std::memory_order_relaxed));
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -362,8 +362,10 @@ static void
|
|||
sndio_destroy(cubeb * context)
|
||||
{
|
||||
DPR("sndio_destroy()\n");
|
||||
#ifndef DISABLE_LIBSNDIO_DLOPEN
|
||||
if (context->libsndio)
|
||||
dlclose(context->libsndio);
|
||||
#endif
|
||||
free(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright © 2022 Mozilla Foundation
|
||||
*
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
|
||||
#ifndef CUBEB_TRACING_H
|
||||
#define CUBEB_TRACING_H
|
||||
|
||||
/* Empty header to allow hooking up a frame profiler. */
|
||||
|
||||
// To be called once on a thread to register for tracing.
|
||||
#define CUBEB_REGISTER_THREAD(name)
|
||||
// To be called once before a registered threads exits.
|
||||
#define CUBEB_UNREGISTER_THREAD()
|
||||
// Insert a tracing marker, with a particular name.
|
||||
// Phase can be 'x': instant marker, start time but no duration
|
||||
// 'b': beginning of a marker with a duration
|
||||
// 'e': end of a marker with a duration
|
||||
#define CUBEB_TRACE(name, phase)
|
||||
|
||||
#endif // CUBEB_TRACING_H
|
Загрузка…
Ссылка в новой задаче