зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1791896, bug 1791900) for causing build bustages. CLOSED TREE
Backed out changeset baaa1b7a2fd2 (bug 1791900) Backed out changeset 0685eba4e0d6 (bug 1791900) Backed out changeset 51fdfb5f4d52 (bug 1791896)
This commit is contained in:
Родитель
c01a6393db
Коммит
0f722acbe5
|
@ -51,7 +51,7 @@
|
|||
// Allows to get something non-default for the preferred sample-rate, to allow
|
||||
// troubleshooting in the field and testing.
|
||||
#define PREF_CUBEB_FORCE_SAMPLE_RATE "media.cubeb.force_sample_rate"
|
||||
#define PREF_CUBEB_LOGGING_LEVEL "logging.cubeb"
|
||||
#define PREF_CUBEB_LOGGING_LEVEL "media.cubeb.logging_level"
|
||||
// Hidden pref used by tests to force failure to obtain cubeb context
|
||||
#define PREF_CUBEB_FORCE_NULL_CONTEXT "media.cubeb.force_null_context"
|
||||
#define PREF_CUBEB_OUTPUT_VOICE_ROUTING "media.cubeb.output_voice_routing"
|
||||
|
@ -253,14 +253,18 @@ void PrefChanged(const char* aPref, void* aClosure) {
|
|||
StaticMutexAutoLock lock(sMutex);
|
||||
sCubebForcedSampleRate = Preferences::GetUint(aPref);
|
||||
} else if (strcmp(aPref, PREF_CUBEB_LOGGING_LEVEL) == 0) {
|
||||
LogLevel value =
|
||||
ToLogLevel(Preferences::GetInt(aPref, 0 /* LogLevel::Disabled */));
|
||||
if (value == LogLevel::Verbose) {
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString(aPref, value);
|
||||
LogModule* cubebLog = LogModule::Get("cubeb");
|
||||
if (value.EqualsLiteral("verbose")) {
|
||||
cubeb_set_log_callback(CUBEB_LOG_VERBOSE, CubebLogCallback);
|
||||
} else if (value == LogLevel::Debug) {
|
||||
cubebLog->SetLevel(LogLevel::Verbose);
|
||||
} else if (value.EqualsLiteral("normal")) {
|
||||
cubeb_set_log_callback(CUBEB_LOG_NORMAL, CubebLogCallback);
|
||||
} else if (value == LogLevel::Disabled) {
|
||||
cubebLog->SetLevel(LogLevel::Error);
|
||||
} else if (value.IsEmpty()) {
|
||||
cubeb_set_log_callback(CUBEB_LOG_DISABLED, nullptr);
|
||||
cubebLog->SetLevel(LogLevel::Disabled);
|
||||
}
|
||||
} else if (strcmp(aPref, PREF_CUBEB_BACKEND) == 0) {
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
|
@ -372,7 +376,8 @@ bool InitPreferredSampleRate() {
|
|||
return false;
|
||||
}
|
||||
uint32_t rate;
|
||||
if (cubeb_get_preferred_sample_rate(context, &rate) != CUBEB_OK) {
|
||||
if (cubeb_get_preferred_sample_rate(context, &rate) !=
|
||||
CUBEB_OK) {
|
||||
return false;
|
||||
}
|
||||
sPreferredSampleRate = rate;
|
||||
|
|
|
@ -9,8 +9,8 @@ origin:
|
|||
description: "Cross platform audio library"
|
||||
url: https://github.com/mozilla/cubeb
|
||||
license: ISC
|
||||
release: 93d1fa3fccdc22da37aa59f67b213591797db369 (2022-09-22T21:52:54Z).
|
||||
revision: 93d1fa3fccdc22da37aa59f67b213591797db369
|
||||
release: bc0450628e120dbee89fb8ad0b29abbd24dc3729 (2022-09-21T20:32:32Z).
|
||||
revision: bc0450628e120dbee89fb8ad0b29abbd24dc3729
|
||||
|
||||
vendoring:
|
||||
url: https://github.com/mozilla/cubeb
|
||||
|
@ -34,7 +34,6 @@ vendoring:
|
|||
- src/cubeb_kai.c
|
||||
- src/cubeb_osx_run_loop.cpp
|
||||
- src/cubeb_pulse.c
|
||||
- src/cubeb_tracing.h
|
||||
- subprojects
|
||||
- tools
|
||||
keep:
|
||||
|
@ -45,6 +44,5 @@ vendoring:
|
|||
- src/cubeb-jni-instances.h
|
||||
- src/cubeb_assert.h
|
||||
- src/cubeb_osx_run_loop.c
|
||||
- src/cubeb_tracing.h
|
||||
- src/moz.build
|
||||
|
||||
|
|
|
@ -639,7 +639,7 @@ cubeb_enumerate_devices(cubeb * context, cubeb_device_type devtype,
|
|||
|
||||
rv = context->ops->enumerate_devices(context, devtype, collection);
|
||||
|
||||
if (cubeb_log_get_callback()) {
|
||||
if (g_cubeb_log_callback) {
|
||||
for (size_t i = 0; i < collection->count; i++) {
|
||||
log_device(&collection->device[i]);
|
||||
}
|
||||
|
@ -701,11 +701,21 @@ cubeb_set_log_callback(cubeb_log_level log_level,
|
|||
return CUBEB_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (cubeb_log_get_callback() && log_callback) {
|
||||
if (g_cubeb_log_callback && log_callback) {
|
||||
return CUBEB_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
cubeb_log_set(log_level, log_callback);
|
||||
g_cubeb_log_callback = log_callback;
|
||||
g_cubeb_log_level = log_level;
|
||||
|
||||
// Logging a message here allows to initialize the asynchronous logger from a
|
||||
// thread that is not the audio rendering thread, and especially to not
|
||||
// initialize it the first time we find a verbose log, which is often in the
|
||||
// audio rendering callback, that runs from the audio rendering thread, and
|
||||
// that is high priority, and that we don't want to block.
|
||||
if (log_level >= CUBEB_LOG_VERBOSE) {
|
||||
ALOGV("Starting cubeb log");
|
||||
}
|
||||
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define _XOPEN_SOURCE 500
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "cubeb_tracing.h"
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
|
@ -580,14 +579,10 @@ alsa_run_thread(void * context)
|
|||
cubeb * ctx = context;
|
||||
int r;
|
||||
|
||||
CUBEB_REGISTER_THREAD("cubeb rendering thread");
|
||||
|
||||
do {
|
||||
r = alsa_run(ctx);
|
||||
} while (r >= 0);
|
||||
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include <time.h>
|
||||
#endif
|
||||
|
||||
std::atomic<cubeb_log_level> g_cubeb_log_level;
|
||||
std::atomic<cubeb_log_callback> g_cubeb_log_callback;
|
||||
cubeb_log_level g_cubeb_log_level;
|
||||
cubeb_log_callback g_cubeb_log_callback;
|
||||
|
||||
/** The maximum size of a log message, after having been formatted. */
|
||||
const size_t CUBEB_LOG_MESSAGE_MAX_SIZE = 256;
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
while (true) {
|
||||
cubeb_log_message msg;
|
||||
while (msg_queue.dequeue(&msg, 1)) {
|
||||
cubeb_log_internal_no_format(msg.get());
|
||||
LOG_INTERNAL_NO_FORMAT(CUBEB_LOG_NORMAL, "%s", msg.get());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
Sleep(CUBEB_LOG_BATCH_PRINT_INTERVAL_MS);
|
||||
|
@ -108,26 +108,12 @@ private:
|
|||
lock_free_queue<cubeb_log_message> msg_queue;
|
||||
};
|
||||
|
||||
void
|
||||
cubeb_log_internal(char const * file, uint32_t line, char const * fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
char msg[CUBEB_LOG_MESSAGE_MAX_SIZE];
|
||||
vsnprintf(msg, CUBEB_LOG_MESSAGE_MAX_SIZE, fmt, args);
|
||||
g_cubeb_log_callback.load()("%s:%d:%s", file, line, msg);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_log_internal_no_format(const char * msg)
|
||||
{
|
||||
g_cubeb_log_callback.load()(msg);
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_async_log(char const * fmt, ...)
|
||||
{
|
||||
if (!g_cubeb_log_callback) {
|
||||
return;
|
||||
}
|
||||
// This is going to copy a 256 bytes array around, which is fine.
|
||||
// We don't want to allocate memory here, because this is made to
|
||||
// be called from a real-time callback.
|
||||
|
@ -147,22 +133,3 @@ cubeb_async_log_reset_threads(void)
|
|||
}
|
||||
cubeb_async_logger::get().reset_producer_thread();
|
||||
}
|
||||
|
||||
void
|
||||
cubeb_log_set(cubeb_log_level log_level, cubeb_log_callback log_callback)
|
||||
{
|
||||
g_cubeb_log_level = log_level;
|
||||
g_cubeb_log_callback = log_callback;
|
||||
}
|
||||
|
||||
cubeb_log_level
|
||||
cubeb_log_get_level()
|
||||
{
|
||||
return g_cubeb_log_level;
|
||||
}
|
||||
|
||||
cubeb_log_callback
|
||||
cubeb_log_get_callback()
|
||||
{
|
||||
return g_cubeb_log_callback;
|
||||
}
|
||||
|
|
|
@ -30,16 +30,8 @@ extern "C" {
|
|||
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
#endif
|
||||
|
||||
void
|
||||
cubeb_log_set(cubeb_log_level log_level, cubeb_log_callback log_callback);
|
||||
cubeb_log_level
|
||||
cubeb_log_get_level();
|
||||
cubeb_log_callback
|
||||
cubeb_log_get_callback();
|
||||
void
|
||||
cubeb_log_internal_no_format(const char * msg);
|
||||
void
|
||||
cubeb_log_internal(const char * filename, uint32_t line, const char * fmt, ...);
|
||||
extern cubeb_log_level g_cubeb_log_level;
|
||||
extern cubeb_log_callback g_cubeb_log_callback PRINTF_FORMAT(1, 2);
|
||||
void
|
||||
cubeb_async_log(const char * fmt, ...);
|
||||
void
|
||||
|
@ -52,16 +44,24 @@ cubeb_async_log_reset_threads(void);
|
|||
#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 (cubeb_log_get_level() <= level && cubeb_log_get_callback()) { \
|
||||
cubeb_log_internal(__FILENAME__, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
if (g_cubeb_log_callback && level <= g_cubeb_log_level) { \
|
||||
g_cubeb_log_callback("%s:%d: " fmt "\n", __FILENAME__, __LINE__, \
|
||||
##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ALOG_INTERNAL(level, fmt, ...) \
|
||||
do { \
|
||||
if (cubeb_log_get_level() <= level && cubeb_log_get_callback()) { \
|
||||
if (level <= g_cubeb_log_level) { \
|
||||
cubeb_async_log(fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "cubeb/cubeb.h"
|
||||
#include "cubeb_mixer.h"
|
||||
#include "cubeb_strings.h"
|
||||
#include "cubeb_tracing.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
@ -976,8 +975,6 @@ oss_io_routine(void * arg)
|
|||
cubeb_state new_state;
|
||||
int stopped;
|
||||
|
||||
CUBEB_REGISTER_THREAD("cubeb rendering thread");
|
||||
|
||||
do {
|
||||
pthread_mutex_lock(&s->mtx);
|
||||
if (s->destroying) {
|
||||
|
@ -1008,9 +1005,6 @@ oss_io_routine(void * arg)
|
|||
pthread_mutex_lock(&s->mtx);
|
||||
s->thread_created = false;
|
||||
pthread_mutex_unlock(&s->mtx);
|
||||
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "cubeb_tracing.h"
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
#include <inttypes.h>
|
||||
|
@ -162,14 +161,10 @@ sndio_mainloop(void * arg)
|
|||
size_t pstart = 0, pend = 0, rstart = 0, rend = 0;
|
||||
long nfr;
|
||||
|
||||
CUBEB_REGISTER_THREAD("cubeb rendering thread");
|
||||
|
||||
nfds = WRAP(sio_nfds)(s->hdl);
|
||||
pfds = calloc(nfds, sizeof(struct pollfd));
|
||||
if (pfds == NULL) {
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
if (pfds == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DPR("sndio_mainloop()\n");
|
||||
s->state_cb(s, s->arg, CUBEB_STATE_STARTED);
|
||||
|
@ -177,7 +172,6 @@ sndio_mainloop(void * arg)
|
|||
if (!WRAP(sio_start)(s->hdl)) {
|
||||
pthread_mutex_unlock(&s->mtx);
|
||||
free(pfds);
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
return NULL;
|
||||
}
|
||||
DPR("sndio_mainloop(), started\n");
|
||||
|
@ -306,7 +300,6 @@ sndio_mainloop(void * arg)
|
|||
pthread_mutex_unlock(&s->mtx);
|
||||
s->state_cb(s, s->arg, state);
|
||||
free(pfds);
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
#include "cubeb_tracing.h"
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
|
@ -429,8 +428,6 @@ sun_io_routine(void * arg)
|
|||
size_t read_ofs = 0;
|
||||
int drain = 0;
|
||||
|
||||
CUBEB_REGISTER_THREAD("cubeb rendering thread");
|
||||
|
||||
s->state_cb(s, s->user_ptr, CUBEB_STATE_STARTED);
|
||||
while (state != CUBEB_STATE_ERROR) {
|
||||
pthread_mutex_lock(&s->mutex);
|
||||
|
@ -508,7 +505,6 @@ sun_io_routine(void * arg)
|
|||
}
|
||||
}
|
||||
s->state_cb(s, s->user_ptr, state);
|
||||
CUBEB_UNREGISTER_THREAD();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
* 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
|
||||
|
||||
#include <MicroGeckoProfiler.h>
|
||||
|
||||
#define CUBEB_REGISTER_THREAD(name) \
|
||||
do { \
|
||||
char stacktop; \
|
||||
uprofiler_register_thread(name, &stacktop); \
|
||||
} while (0)
|
||||
|
||||
#define CUBEB_UNREGISTER_THREAD() uprofiler_unregister_thread()
|
||||
/* 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) \
|
||||
uprofiler_simple_event_marker(name, phase, 0, NULL, NULL, NULL)
|
||||
#define CUBEB_TRACE(name, phase)
|
||||
|
||||
#endif // CUBEB_TRACING_H
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "cubeb_mixer.h"
|
||||
#include "cubeb_resampler.h"
|
||||
#include "cubeb_strings.h"
|
||||
#include "cubeb_tracing.h"
|
||||
#include "cubeb_utils.h"
|
||||
|
||||
// Windows 10 exposes the IAudioClient3 interface to create low-latency streams.
|
||||
|
@ -224,11 +223,6 @@ private:
|
|||
com_heap_ptr<wchar_t> capture_comms_id;
|
||||
};
|
||||
|
||||
struct AutoRegisterThread {
|
||||
AutoRegisterThread(const char * name) { CUBEB_REGISTER_THREAD(name); }
|
||||
~AutoRegisterThread() { CUBEB_UNREGISTER_THREAD(); }
|
||||
};
|
||||
|
||||
int
|
||||
wasapi_stream_stop(cubeb_stream * stm);
|
||||
int
|
||||
|
@ -469,7 +463,6 @@ public:
|
|||
private:
|
||||
static unsigned int __stdcall thread_proc(LPVOID args)
|
||||
{
|
||||
AutoRegisterThread raii("WASAPI device notification thread");
|
||||
XASSERT(args);
|
||||
auto mdn = static_cast<monitor_device_notifications *>(args);
|
||||
mdn->notification_thread_loop();
|
||||
|
@ -1344,8 +1337,6 @@ handle_emergency_bailout(cubeb_stream * stm)
|
|||
|
||||
static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream)
|
||||
{
|
||||
AutoRegisterThread raii("cubeb rendering thread");
|
||||
|
||||
cubeb_stream * stm = static_cast<cubeb_stream *>(stream);
|
||||
|
||||
bool is_playing = true;
|
||||
|
|
|
@ -151,7 +151,6 @@ include("/ipc/chromium/chromium-config.mozbuild")
|
|||
EXPORTS += [
|
||||
"public/ChildProfilerController.h",
|
||||
"public/GeckoProfiler.h",
|
||||
"public/MicroGeckoProfiler.h",
|
||||
"public/ProfilerBindings.h",
|
||||
"public/ProfilerControl.h",
|
||||
"public/ProfilerParent.h",
|
||||
|
|
Загрузка…
Ссылка в новой задаче