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:
Butkovits Atila 2022-09-30 03:59:10 +03:00
parent c01a6393db
commit 0f722acbe5
12 changed files with 59 additions and 115 deletions

View file

@ -51,7 +51,7 @@
// Allows to get something non-default for the preferred sample-rate, to allow // Allows to get something non-default for the preferred sample-rate, to allow
// troubleshooting in the field and testing. // troubleshooting in the field and testing.
#define PREF_CUBEB_FORCE_SAMPLE_RATE "media.cubeb.force_sample_rate" #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 // 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_FORCE_NULL_CONTEXT "media.cubeb.force_null_context"
#define PREF_CUBEB_OUTPUT_VOICE_ROUTING "media.cubeb.output_voice_routing" #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); StaticMutexAutoLock lock(sMutex);
sCubebForcedSampleRate = Preferences::GetUint(aPref); sCubebForcedSampleRate = Preferences::GetUint(aPref);
} else if (strcmp(aPref, PREF_CUBEB_LOGGING_LEVEL) == 0) { } else if (strcmp(aPref, PREF_CUBEB_LOGGING_LEVEL) == 0) {
LogLevel value = nsAutoCString value;
ToLogLevel(Preferences::GetInt(aPref, 0 /* LogLevel::Disabled */)); Preferences::GetCString(aPref, value);
if (value == LogLevel::Verbose) { LogModule* cubebLog = LogModule::Get("cubeb");
if (value.EqualsLiteral("verbose")) {
cubeb_set_log_callback(CUBEB_LOG_VERBOSE, CubebLogCallback); 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); 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); cubeb_set_log_callback(CUBEB_LOG_DISABLED, nullptr);
cubebLog->SetLevel(LogLevel::Disabled);
} }
} else if (strcmp(aPref, PREF_CUBEB_BACKEND) == 0) { } else if (strcmp(aPref, PREF_CUBEB_BACKEND) == 0) {
StaticMutexAutoLock lock(sMutex); StaticMutexAutoLock lock(sMutex);
@ -372,7 +376,8 @@ bool InitPreferredSampleRate() {
return false; return false;
} }
uint32_t rate; 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; return false;
} }
sPreferredSampleRate = rate; sPreferredSampleRate = rate;

View file

@ -9,8 +9,8 @@ origin:
description: "Cross platform audio library" description: "Cross platform audio library"
url: https://github.com/mozilla/cubeb url: https://github.com/mozilla/cubeb
license: ISC license: ISC
release: 93d1fa3fccdc22da37aa59f67b213591797db369 (2022-09-22T21:52:54Z). release: bc0450628e120dbee89fb8ad0b29abbd24dc3729 (2022-09-21T20:32:32Z).
revision: 93d1fa3fccdc22da37aa59f67b213591797db369 revision: bc0450628e120dbee89fb8ad0b29abbd24dc3729
vendoring: vendoring:
url: https://github.com/mozilla/cubeb url: https://github.com/mozilla/cubeb
@ -34,7 +34,6 @@ vendoring:
- src/cubeb_kai.c - src/cubeb_kai.c
- src/cubeb_osx_run_loop.cpp - src/cubeb_osx_run_loop.cpp
- src/cubeb_pulse.c - src/cubeb_pulse.c
- src/cubeb_tracing.h
- subprojects - subprojects
- tools - tools
keep: keep:
@ -45,6 +44,5 @@ vendoring:
- src/cubeb-jni-instances.h - src/cubeb-jni-instances.h
- src/cubeb_assert.h - src/cubeb_assert.h
- src/cubeb_osx_run_loop.c - src/cubeb_osx_run_loop.c
- src/cubeb_tracing.h
- src/moz.build - src/moz.build

View file

@ -639,7 +639,7 @@ cubeb_enumerate_devices(cubeb * context, cubeb_device_type devtype,
rv = context->ops->enumerate_devices(context, devtype, collection); 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++) { for (size_t i = 0; i < collection->count; i++) {
log_device(&collection->device[i]); log_device(&collection->device[i]);
} }
@ -701,11 +701,21 @@ cubeb_set_log_callback(cubeb_log_level log_level,
return CUBEB_ERROR_INVALID_PARAMETER; return CUBEB_ERROR_INVALID_PARAMETER;
} }
if (cubeb_log_get_callback() && log_callback) { if (g_cubeb_log_callback && log_callback) {
return CUBEB_ERROR_NOT_SUPPORTED; 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; return CUBEB_OK;
} }

View file

@ -10,7 +10,6 @@
#define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE 500
#include "cubeb-internal.h" #include "cubeb-internal.h"
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "cubeb_tracing.h"
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#include <assert.h> #include <assert.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -580,14 +579,10 @@ alsa_run_thread(void * context)
cubeb * ctx = context; cubeb * ctx = context;
int r; int r;
CUBEB_REGISTER_THREAD("cubeb rendering thread");
do { do {
r = alsa_run(ctx); r = alsa_run(ctx);
} while (r >= 0); } while (r >= 0);
CUBEB_UNREGISTER_THREAD();
return NULL; return NULL;
} }

View file

@ -16,8 +16,8 @@
#include <time.h> #include <time.h>
#endif #endif
std::atomic<cubeb_log_level> g_cubeb_log_level; cubeb_log_level g_cubeb_log_level;
std::atomic<cubeb_log_callback> g_cubeb_log_callback; cubeb_log_callback g_cubeb_log_callback;
/** The maximum size of a log message, after having been formatted. */ /** The maximum size of a log message, after having been formatted. */
const size_t CUBEB_LOG_MESSAGE_MAX_SIZE = 256; const size_t CUBEB_LOG_MESSAGE_MAX_SIZE = 256;
@ -74,7 +74,7 @@ public:
while (true) { while (true) {
cubeb_log_message msg; cubeb_log_message msg;
while (msg_queue.dequeue(&msg, 1)) { 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 #ifdef _WIN32
Sleep(CUBEB_LOG_BATCH_PRINT_INTERVAL_MS); Sleep(CUBEB_LOG_BATCH_PRINT_INTERVAL_MS);
@ -108,26 +108,12 @@ private:
lock_free_queue<cubeb_log_message> msg_queue; 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 void
cubeb_async_log(char const * fmt, ...) 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. // 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 // We don't want to allocate memory here, because this is made to
// be called from a real-time callback. // be called from a real-time callback.
@ -147,22 +133,3 @@ cubeb_async_log_reset_threads(void)
} }
cubeb_async_logger::get().reset_producer_thread(); 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;
}

View file

@ -30,16 +30,8 @@ extern "C" {
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#endif #endif
void extern cubeb_log_level g_cubeb_log_level;
cubeb_log_set(cubeb_log_level log_level, cubeb_log_callback log_callback); extern cubeb_log_callback g_cubeb_log_callback PRINTF_FORMAT(1, 2);
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, ...);
void void
cubeb_async_log(const char * fmt, ...); cubeb_async_log(const char * fmt, ...);
void void
@ -52,16 +44,24 @@ cubeb_async_log_reset_threads(void);
#define LOGV(msg, ...) LOG_INTERNAL(CUBEB_LOG_VERBOSE, msg, ##__VA_ARGS__) #define LOGV(msg, ...) LOG_INTERNAL(CUBEB_LOG_VERBOSE, msg, ##__VA_ARGS__)
#define LOG(msg, ...) LOG_INTERNAL(CUBEB_LOG_NORMAL, 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, ...) \ #define LOG_INTERNAL(level, fmt, ...) \
do { \ do { \
if (cubeb_log_get_level() <= level && cubeb_log_get_callback()) { \ if (g_cubeb_log_callback && level <= g_cubeb_log_level) { \
cubeb_log_internal(__FILENAME__, __LINE__, fmt, ##__VA_ARGS__); \ g_cubeb_log_callback("%s:%d: " fmt "\n", __FILENAME__, __LINE__, \
##__VA_ARGS__); \
} \ } \
} while (0) } while (0)
#define ALOG_INTERNAL(level, fmt, ...) \ #define ALOG_INTERNAL(level, fmt, ...) \
do { \ do { \
if (cubeb_log_get_level() <= level && cubeb_log_get_callback()) { \ if (level <= g_cubeb_log_level) { \
cubeb_async_log(fmt, ##__VA_ARGS__); \ cubeb_async_log(fmt, ##__VA_ARGS__); \
} \ } \
} while (0) } while (0)

View file

@ -14,7 +14,6 @@
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "cubeb_mixer.h" #include "cubeb_mixer.h"
#include "cubeb_strings.h" #include "cubeb_strings.h"
#include "cubeb_tracing.h"
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
@ -976,8 +975,6 @@ oss_io_routine(void * arg)
cubeb_state new_state; cubeb_state new_state;
int stopped; int stopped;
CUBEB_REGISTER_THREAD("cubeb rendering thread");
do { do {
pthread_mutex_lock(&s->mtx); pthread_mutex_lock(&s->mtx);
if (s->destroying) { if (s->destroying) {
@ -1008,9 +1005,6 @@ oss_io_routine(void * arg)
pthread_mutex_lock(&s->mtx); pthread_mutex_lock(&s->mtx);
s->thread_created = false; s->thread_created = false;
pthread_mutex_unlock(&s->mtx); pthread_mutex_unlock(&s->mtx);
CUBEB_UNREGISTER_THREAD();
return NULL; return NULL;
} }

View file

@ -6,7 +6,6 @@
*/ */
#include "cubeb-internal.h" #include "cubeb-internal.h"
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "cubeb_tracing.h"
#include <assert.h> #include <assert.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <inttypes.h> #include <inttypes.h>
@ -162,14 +161,10 @@ sndio_mainloop(void * arg)
size_t pstart = 0, pend = 0, rstart = 0, rend = 0; size_t pstart = 0, pend = 0, rstart = 0, rend = 0;
long nfr; long nfr;
CUBEB_REGISTER_THREAD("cubeb rendering thread");
nfds = WRAP(sio_nfds)(s->hdl); nfds = WRAP(sio_nfds)(s->hdl);
pfds = calloc(nfds, sizeof(struct pollfd)); pfds = calloc(nfds, sizeof(struct pollfd));
if (pfds == NULL) { if (pfds == NULL)
CUBEB_UNREGISTER_THREAD();
return NULL; return NULL;
}
DPR("sndio_mainloop()\n"); DPR("sndio_mainloop()\n");
s->state_cb(s, s->arg, CUBEB_STATE_STARTED); s->state_cb(s, s->arg, CUBEB_STATE_STARTED);
@ -177,7 +172,6 @@ sndio_mainloop(void * arg)
if (!WRAP(sio_start)(s->hdl)) { if (!WRAP(sio_start)(s->hdl)) {
pthread_mutex_unlock(&s->mtx); pthread_mutex_unlock(&s->mtx);
free(pfds); free(pfds);
CUBEB_UNREGISTER_THREAD();
return NULL; return NULL;
} }
DPR("sndio_mainloop(), started\n"); DPR("sndio_mainloop(), started\n");
@ -306,7 +300,6 @@ sndio_mainloop(void * arg)
pthread_mutex_unlock(&s->mtx); pthread_mutex_unlock(&s->mtx);
s->state_cb(s, s->arg, state); s->state_cb(s, s->arg, state);
free(pfds); free(pfds);
CUBEB_UNREGISTER_THREAD();
return NULL; return NULL;
} }

View file

@ -6,7 +6,6 @@
*/ */
#include "cubeb-internal.h" #include "cubeb-internal.h"
#include "cubeb/cubeb.h" #include "cubeb/cubeb.h"
#include "cubeb_tracing.h"
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <pthread.h> #include <pthread.h>
@ -429,8 +428,6 @@ sun_io_routine(void * arg)
size_t read_ofs = 0; size_t read_ofs = 0;
int drain = 0; int drain = 0;
CUBEB_REGISTER_THREAD("cubeb rendering thread");
s->state_cb(s, s->user_ptr, CUBEB_STATE_STARTED); s->state_cb(s, s->user_ptr, CUBEB_STATE_STARTED);
while (state != CUBEB_STATE_ERROR) { while (state != CUBEB_STATE_ERROR) {
pthread_mutex_lock(&s->mutex); pthread_mutex_lock(&s->mutex);
@ -508,7 +505,6 @@ sun_io_routine(void * arg)
} }
} }
s->state_cb(s, s->user_ptr, state); s->state_cb(s, s->user_ptr, state);
CUBEB_UNREGISTER_THREAD();
return NULL; return NULL;
} }

View file

@ -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: */ * Copyright © 2022 Mozilla Foundation
/* 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 * This program is made available under an ISC-style license. See the
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * accompanying file LICENSE for details.
*/
#ifndef CUBEB_TRACING_H #ifndef CUBEB_TRACING_H
#define CUBEB_TRACING_H #define CUBEB_TRACING_H
#include <MicroGeckoProfiler.h> /* Empty header to allow hooking up a frame profiler. */
#define CUBEB_REGISTER_THREAD(name) \
do { \
char stacktop; \
uprofiler_register_thread(name, &stacktop); \
} while (0)
#define CUBEB_UNREGISTER_THREAD() uprofiler_unregister_thread()
// 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. // Insert a tracing marker, with a particular name.
// Phase can be 'x': instant marker, start time but no duration // Phase can be 'x': instant marker, start time but no duration
// 'b': beginning of a marker with a duration // 'b': beginning of a marker with a duration
// 'e': end of a marker with a duration // 'e': end of a marker with a duration
#define CUBEB_TRACE(name, phase) \ #define CUBEB_TRACE(name, phase)
uprofiler_simple_event_marker(name, phase, 0, NULL, NULL, NULL)
#endif // CUBEB_TRACING_H #endif // CUBEB_TRACING_H

View file

@ -30,7 +30,6 @@
#include "cubeb_mixer.h" #include "cubeb_mixer.h"
#include "cubeb_resampler.h" #include "cubeb_resampler.h"
#include "cubeb_strings.h" #include "cubeb_strings.h"
#include "cubeb_tracing.h"
#include "cubeb_utils.h" #include "cubeb_utils.h"
// Windows 10 exposes the IAudioClient3 interface to create low-latency streams. // Windows 10 exposes the IAudioClient3 interface to create low-latency streams.
@ -224,11 +223,6 @@ private:
com_heap_ptr<wchar_t> capture_comms_id; com_heap_ptr<wchar_t> capture_comms_id;
}; };
struct AutoRegisterThread {
AutoRegisterThread(const char * name) { CUBEB_REGISTER_THREAD(name); }
~AutoRegisterThread() { CUBEB_UNREGISTER_THREAD(); }
};
int int
wasapi_stream_stop(cubeb_stream * stm); wasapi_stream_stop(cubeb_stream * stm);
int int
@ -469,7 +463,6 @@ public:
private: private:
static unsigned int __stdcall thread_proc(LPVOID args) static unsigned int __stdcall thread_proc(LPVOID args)
{ {
AutoRegisterThread raii("WASAPI device notification thread");
XASSERT(args); XASSERT(args);
auto mdn = static_cast<monitor_device_notifications *>(args); auto mdn = static_cast<monitor_device_notifications *>(args);
mdn->notification_thread_loop(); mdn->notification_thread_loop();
@ -1344,8 +1337,6 @@ handle_emergency_bailout(cubeb_stream * stm)
static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream) static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream)
{ {
AutoRegisterThread raii("cubeb rendering thread");
cubeb_stream * stm = static_cast<cubeb_stream *>(stream); cubeb_stream * stm = static_cast<cubeb_stream *>(stream);
bool is_playing = true; bool is_playing = true;

View file

@ -151,7 +151,6 @@ include("/ipc/chromium/chromium-config.mozbuild")
EXPORTS += [ EXPORTS += [
"public/ChildProfilerController.h", "public/ChildProfilerController.h",
"public/GeckoProfiler.h", "public/GeckoProfiler.h",
"public/MicroGeckoProfiler.h",
"public/ProfilerBindings.h", "public/ProfilerBindings.h",
"public/ProfilerControl.h", "public/ProfilerControl.h",
"public/ProfilerParent.h", "public/ProfilerParent.h",