tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 1e427e3e2c169d72c436d4b23684d6d5a9c530cd
parent 7095f6d0c2a7bdb551fd314820a9a768835e3c1f
Author: Matthew Gregan <kinetik@flim.org>
Date:   Thu,  4 Dec 2025 20:21:52 +0000

Bug 2003927 - Update libcubeb to bed368eb0d901ec4b7921a8d704ca469b7fb4e19.  r=cubeb-reviewers,pehrsons

Differential Revision: https://phabricator.services.mozilla.com/D275001

Diffstat:
Mmedia/libcubeb/0001-disable-aaudio-before-android-31.patch | 7++-----
Mmedia/libcubeb/moz.yaml | 4++--
Mmedia/libcubeb/src/cubeb_aaudio.cpp | 126+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mmedia/libcubeb/src/cubeb_audiounit.cpp | 17++++++++++++-----
Mmedia/libcubeb/src/cubeb_log.cpp | 6+++++-
Mmedia/libcubeb/src/cubeb_log.h | 5+++--
Mmedia/libcubeb/src/cubeb_opensl.cpp | 55+++++++++++++++++++++++++++----------------------------
Mmedia/libcubeb/src/cubeb_resampler_internal.h | 2+-
Mmedia/libcubeb/src/cubeb_wasapi.cpp | 18++++++++++--------
9 files changed, 137 insertions(+), 103 deletions(-)

diff --git a/media/libcubeb/0001-disable-aaudio-before-android-31.patch b/media/libcubeb/0001-disable-aaudio-before-android-31.patch @@ -19,7 +19,7 @@ diff --git a/src/cubeb_aaudio.cpp b/media/libcubeb/src/cubeb_aaudio.cpp #include <cstring> #include <dlfcn.h> #include <inttypes.h> -@@ -1700,16 +1701,19 @@ const static struct cubeb_ops aaudio_ops +@@ -1700,13 +1701,16 @@ const static struct cubeb_ops aaudio_ops /*.stream_get_current_device =*/nullptr, /*.stream_device_destroy =*/nullptr, /*.stream_register_device_changed_callback =*/nullptr, @@ -31,11 +31,8 @@ diff --git a/src/cubeb_aaudio.cpp b/media/libcubeb/src/cubeb_aaudio.cpp + if (android_get_device_api_level() <= 30) { + return CUBEB_ERROR; + } - // load api - void * libaaudio = nullptr; #ifndef DISABLE_LIBAAUDIO_DLOPEN - libaaudio = dlopen("libaaudio.so", RTLD_NOW); - if (!libaaudio) { + if (!AAudioLibrary::get().load()) { return CUBEB_ERROR; } diff --git a/media/libcubeb/moz.yaml b/media/libcubeb/moz.yaml @@ -9,8 +9,8 @@ origin: description: "Cross platform audio library" url: https://github.com/mozilla/cubeb license: ISC - release: 19994eb29cfe4f7347eda3be2f14775e964a2471 (2025-09-09T22:52:22Z). - revision: 19994eb29cfe4f7347eda3be2f14775e964a2471 + release: bed368eb0d901ec4b7921a8d704ca469b7fb4e19 (2025-12-03T20:57:55Z). + revision: bed368eb0d901ec4b7921a8d704ca469b7fb4e19 vendoring: url: https://github.com/mozilla/cubeb diff --git a/media/libcubeb/src/cubeb_aaudio.cpp b/media/libcubeb/src/cubeb_aaudio.cpp @@ -32,7 +32,7 @@ using namespace std; #ifdef DISABLE_LIBAAUDIO_DLOPEN #define WRAP(x) x #else -#define WRAP(x) (*cubeb_##x) +#define WRAP(x) AAudioLibrary::get().x #define LIBAAUDIO_API_VISIT(X) \ X(AAudio_convertResultToText) \ X(AAudio_convertStreamStateToText) \ @@ -70,27 +70,67 @@ using namespace std; X(AAudioStreamBuilder_setUsage) \ X(AAudioStreamBuilder_setFramesPerDataCallback) -// not needed or added later on \ - // X(AAudioStreamBuilder_setDeviceId) \ - // X(AAudioStreamBuilder_setSamplesPerFrame) \ - // X(AAudioStream_getSamplesPerFrame) \ - // X(AAudioStream_getDeviceId) \ - // X(AAudioStream_write) \ - // X(AAudioStream_getChannelCount) \ - // X(AAudioStream_getFormat) \ - // X(AAudioStream_getXRunCount) \ - // X(AAudioStream_isMMapUsed) \ - // X(AAudioStreamBuilder_setContentType) \ - // X(AAudioStreamBuilder_setSessionId) \ - // X(AAudioStream_getUsage) \ - // X(AAudioStream_getContentType) \ - // X(AAudioStream_getInputPreset) \ - // X(AAudioStream_getSessionId) \ -// END: not needed or added later on - -#define MAKE_TYPEDEF(x) static decltype(x) * cubeb_##x; -LIBAAUDIO_API_VISIT(MAKE_TYPEDEF) -#undef MAKE_TYPEDEF +class AAudioLibrary { +public: + static AAudioLibrary & get() + { + static AAudioLibrary singleton; + return singleton; + } + + bool load() + { + lock_guard lock(mutex); + if (state != State::Uninitialized) { + return state == State::Loaded; + } + + libaaudio = dlopen("libaaudio.so", RTLD_NOW); + if (!libaaudio) { + LOG("AAudio: Failed to open libaaudio.so: %s", dlerror()); + state = State::Failed; + return false; + } + +#define LOAD(x) \ + x = reinterpret_cast<decltype(::x) *>(dlsym(libaaudio, #x)); \ + if (!x) { \ + LOG("AAudio: Failed to load symbol %s: %s", #x, dlerror()); \ + dlclose(libaaudio); \ + libaaudio = nullptr; \ + state = State::Failed; \ + return false; \ + } + LIBAAUDIO_API_VISIT(LOAD) +#undef LOAD + + state = State::Loaded; + return true; + } + +#define DECLARE(x) decltype(::x) * x = nullptr; + LIBAAUDIO_API_VISIT(DECLARE) +#undef DECLARE + +private: + enum class State { Uninitialized, Loaded, Failed }; + + AAudioLibrary() = default; + + ~AAudioLibrary() + { + if (libaaudio) { + dlclose(libaaudio); + } + } + + AAudioLibrary(const AAudioLibrary &) = delete; + AAudioLibrary & operator=(const AAudioLibrary &) = delete; + + void * libaaudio = nullptr; + State state = State::Uninitialized; + mutex mutex; +}; #endif const uint8_t MAX_STREAMS = 16; @@ -322,7 +362,6 @@ struct cubeb_stream { struct cubeb { struct cubeb_ops const * ops{}; - void * libaaudio{}; struct { // The state thread: it waits for state changes and stops @@ -377,7 +416,7 @@ wait_for_state_change(AAudioStream * aaudio_stream, *desired_state = new_state; LOG("wait_for_state_change: current state now: %s", - cubeb_AAudio_convertStreamStateToText(new_state)); + WRAP(AAudio_convertStreamStateToText)(new_state)); return CUBEB_OK; } @@ -587,9 +626,16 @@ update_state(cubeb_stream * stm) } break; case stream_state::STOPPING: - assert(!istate || istate == AAUDIO_STREAM_STATE_PAUSING || + // If stream_stop happens while the stream is still starting, we may see + // STARTING/STARTED, ignore these and handle STATE_STOPPED once we reach + // PAUSED. + assert(!istate || istate == AAUDIO_STREAM_STATE_STARTING || + istate == AAUDIO_STREAM_STATE_STARTED || + istate == AAUDIO_STREAM_STATE_PAUSING || istate == AAUDIO_STREAM_STATE_PAUSED); - assert(!ostate || ostate == AAUDIO_STREAM_STATE_PAUSING || + assert(!ostate || ostate == AAUDIO_STREAM_STATE_STARTING || + ostate == AAUDIO_STREAM_STATE_STARTED || + ostate == AAUDIO_STREAM_STATE_PAUSING || ostate == AAUDIO_STREAM_STATE_PAUSED); if ((!istate || istate == AAUDIO_STREAM_STATE_PAUSED) && (!ostate || ostate == AAUDIO_STREAM_STATE_PAUSED)) { @@ -719,11 +765,6 @@ 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; } @@ -1665,8 +1706,8 @@ aaudio_stream_stop_locked(cubeb_stream * stm, lock_guard<mutex> & lock) ? WRAP(AAudioStream_getState)(stm->ostream) : AAUDIO_STREAM_STATE_UNINITIALIZED; LOG("STOPPING stream %p: %d (in: %s out: %s)", (void *)stm, state, - cubeb_AAudio_convertStreamStateToText(istate), - cubeb_AAudio_convertStreamStateToText(ostate)); + WRAP(AAudio_convertStreamStateToText)(istate), + WRAP(AAudio_convertStreamStateToText)(ostate)); switch (state) { case stream_state::STOPPED: @@ -1985,31 +2026,14 @@ 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 - libaaudio = dlopen("libaaudio.so", RTLD_NOW); - if (!libaaudio) { + if (!AAudioLibrary::get().load()) { return CUBEB_ERROR; } - -#define LOAD(x) \ - { \ - cubeb_##x = (decltype(x) *)(dlsym(libaaudio, #x)); \ - if (!WRAP(x)) { \ - LOG("AAudio: Failed to load %s", #x); \ - dlclose(libaaudio); \ - return CUBEB_ERROR; \ - } \ - } - - LIBAAUDIO_API_VISIT(LOAD); -#undef LOAD #endif cubeb * ctx = new cubeb; ctx->ops = &aaudio_ops; - ctx->libaaudio = libaaudio; ctx->state.thread = std::thread(state_thread, ctx); diff --git a/media/libcubeb/src/cubeb_audiounit.cpp b/media/libcubeb/src/cubeb_audiounit.cpp @@ -228,12 +228,19 @@ struct cubeb_stream { cubeb_device_changed_callback device_changed_callback = nullptr; owned_critical_section device_changed_callback_lock; /* Stream creation parameters */ - cubeb_stream_params input_stream_params = {CUBEB_SAMPLE_FLOAT32NE, 0, 0, + cubeb_stream_params input_stream_params = {CUBEB_SAMPLE_FLOAT32NE, + 0, + 0, CUBEB_LAYOUT_UNDEFINED, - CUBEB_STREAM_PREF_NONE}; - cubeb_stream_params output_stream_params = {CUBEB_SAMPLE_FLOAT32NE, 0, 0, - CUBEB_LAYOUT_UNDEFINED, - CUBEB_STREAM_PREF_NONE}; + CUBEB_STREAM_PREF_NONE, + CUBEB_INPUT_PROCESSING_PARAM_NONE}; + cubeb_stream_params output_stream_params = { + CUBEB_SAMPLE_FLOAT32NE, + 0, + 0, + CUBEB_LAYOUT_UNDEFINED, + CUBEB_STREAM_PREF_NONE, + CUBEB_INPUT_PROCESSING_PARAM_NONE}; device_info input_device; device_info output_device; /* Format descriptions */ diff --git a/media/libcubeb/src/cubeb_log.cpp b/media/libcubeb/src/cubeb_log.cpp @@ -207,10 +207,14 @@ cubeb_log_set(cubeb_log_level log_level, cubeb_log_callback log_callback) // nullptr, to prevent a TOCTOU race between checking the pointer if (log_callback && log_level != CUBEB_LOG_DISABLED) { g_cubeb_log_callback = log_callback; - cubeb_async_logger::get().start(); + if (log_level == CUBEB_LOG_VERBOSE) { + cubeb_async_logger::get().start(); + } } else if (!log_callback || CUBEB_LOG_DISABLED) { g_cubeb_log_callback = cubeb_noop_log_callback; // This returns once the thread has joined. + // This is safe even if CUBEB_LOG_VERBOSE was not set; the thread will + // simply not be joinable. cubeb_async_logger::get().stop(); } else { assert(false && "Incorrect parameters passed to cubeb_log_set"); diff --git a/media/libcubeb/src/cubeb_log.h b/media/libcubeb/src/cubeb_log.h @@ -39,9 +39,10 @@ cubeb_log_get_callback(void); void cubeb_log_internal_no_format(const char * msg); void -cubeb_log_internal(const char * filename, uint32_t line, const char * fmt, ...); +cubeb_log_internal(const char * filename, uint32_t line, const char * fmt, ...) + PRINTF_FORMAT(3, 4); void -cubeb_async_log(const char * fmt, ...); +cubeb_async_log(const char * fmt, ...) PRINTF_FORMAT(1, 2); void cubeb_async_log_reset_threads(void); diff --git a/media/libcubeb/src/cubeb_opensl.cpp b/media/libcubeb/src/cubeb_opensl.cpp @@ -330,7 +330,7 @@ bufferqueue_callback(SLBufferQueueItf caller, void * user_ptr) ALOGV("bufferqueue_callback: resampler fill returned %ld frames", written); if (written < 0 || written * stm->framesize > static_cast<uint32_t>(stm->queuebuf_len)) { - ALOGV("bufferqueue_callback: error, shutting down", written); + ALOGV("bufferqueue_callback: error, shutting down"); r = pthread_mutex_lock(&stm->mutex); XASSERT(r == 0); opensl_set_shutdown(stm, 1); @@ -407,7 +407,7 @@ opensl_enqueue_recorder(cubeb_stream * stm, void ** last_filled_buffer) stm->input_buffer_array[current_index], stm->input_buffer_length); if (res != SL_RESULT_SUCCESS) { - LOG("Enqueue recorder failed. Error code: %lu", res); + LOG("Enqueue recorder failed. Error code: %u", res); return CUBEB_ERROR; } // All good, update buffer and index. @@ -1056,7 +1056,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) } if (res != SL_RESULT_SUCCESS) { LOG("Failed to create recorder, not trying other input" - " rate. Error code: %lu", + " rate. Error code: %u", res); return CUBEB_ERROR; } @@ -1091,7 +1091,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) if (res != SL_RESULT_SUCCESS) { LOG("Failed to get the android configuration interface for recorder. " "Error " - "code: %lu", + "code: %u", res); return CUBEB_ERROR; } @@ -1109,7 +1109,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) if (res != SL_RESULT_SUCCESS) { LOG("Failed to set the android configuration to VOICE for the recorder. " - "Error code: %lu", + "Error code: %u", res); return CUBEB_ERROR; } @@ -1117,7 +1117,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) // realize the audio recorder res = (*stm->recorderObj)->Realize(stm->recorderObj, SL_BOOLEAN_FALSE); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to realize recorder. Error code: %lu", res); + LOG("Failed to realize recorder. Error code: %u", res); return CUBEB_ERROR; } // get the record interface @@ -1125,14 +1125,14 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) ->GetInterface(stm->recorderObj, stm->context->SL_IID_RECORD, &stm->recorderItf); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to get recorder interface. Error code: %lu", res); + LOG("Failed to get recorder interface. Error code: %u", res); return CUBEB_ERROR; } res = (*stm->recorderItf) ->RegisterCallback(stm->recorderItf, recorder_marker_callback, stm); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to register recorder marker callback. Error code: %lu", res); + LOG("Failed to register recorder marker callback. Error code: %u", res); return CUBEB_ERROR; } @@ -1142,7 +1142,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) ->SetCallbackEventsMask(stm->recorderItf, (SLuint32)SL_RECORDEVENT_HEADATMARKER); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to set headatmarker event mask. Error code: %lu", res); + LOG("Failed to set headatmarker event mask. Error code: %u", res); return CUBEB_ERROR; } // get the simple android buffer queue interface @@ -1152,7 +1152,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) &stm->recorderBufferQueueItf); if (res != SL_RESULT_SUCCESS) { LOG("Failed to get recorder (android) buffer queue interface. Error code: " - "%lu", + "%u", res); return CUBEB_ERROR; } @@ -1166,7 +1166,7 @@ opensl_configure_capture(cubeb_stream * stm, cubeb_stream_params * params) res = (*stm->recorderBufferQueueItf) ->RegisterCallback(stm->recorderBufferQueueItf, rec_callback, stm); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to register recorder buffer queue callback. Error code: %lu", + LOG("Failed to register recorder buffer queue callback. Error code: %u", res); return CUBEB_ERROR; } @@ -1278,7 +1278,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) } if (res != SL_RESULT_SUCCESS) { - LOG("Failed to create audio player. Error code: %lu", res); + LOG("Failed to create audio player. Error code: %u", res); return CUBEB_ERROR; } stm->output_configured_rate = preferred_sampling_rate; @@ -1330,8 +1330,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) stm->context->SL_IID_ANDROIDCONFIGURATION, &playerConfig); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to get Android configuration interface. Error code: %lu", - res); + LOG("Failed to get Android configuration interface. Error code: %u", res); return CUBEB_ERROR; } @@ -1343,7 +1342,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) ->SetConfiguration(playerConfig, SL_ANDROID_KEY_STREAM_TYPE, &streamType, sizeof(streamType)); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to set Android configuration to %d Error code: %lu", + LOG("Failed to set Android configuration to %d Error code: %u", streamType, res); } @@ -1357,7 +1356,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) ->SetConfiguration(playerConfig, SL_ANDROID_KEY_PERFORMANCE_MODE, &performanceMode, sizeof(performanceMode)); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to set Android performance mode to %d Error code: %lu. This " + LOG("Failed to set Android performance mode to %d Error code: %u. This " "is not fatal.", performanceMode, res); } @@ -1365,7 +1364,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) res = (*stm->playerObj)->Realize(stm->playerObj, SL_BOOLEAN_FALSE); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to realize player object. Error code: %lu", res); + LOG("Failed to realize player object. Error code: %u", res); return CUBEB_ERROR; } @@ -1413,7 +1412,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) (*stm->playerObj) ->GetInterface(stm->playerObj, stm->context->SL_IID_PLAY, &stm->play); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to get play interface. Error code: %lu", res); + LOG("Failed to get play interface. Error code: %u", res); return CUBEB_ERROR; } @@ -1421,7 +1420,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) ->GetInterface(stm->playerObj, stm->context->SL_IID_BUFFERQUEUE, &stm->bufq); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to get bufferqueue interface. Error code: %lu", res); + LOG("Failed to get bufferqueue interface. Error code: %u", res); return CUBEB_ERROR; } @@ -1429,13 +1428,13 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) ->GetInterface(stm->playerObj, stm->context->SL_IID_VOLUME, &stm->volume); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to get volume interface. Error code: %lu", res); + LOG("Failed to get volume interface. Error code: %u", res); return CUBEB_ERROR; } res = (*stm->play)->RegisterCallback(stm->play, play_callback, stm); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to register play callback. Error code: %lu", res); + LOG("Failed to register play callback. Error code: %u", res); return CUBEB_ERROR; } @@ -1446,7 +1445,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) ->SetCallbackEventsMask(stm->play, (SLuint32)SL_PLAYEVENT_HEADATMARKER); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to set headatmarker event mask. Error code: %lu", res); + LOG("Failed to set headatmarker event mask. Error code: %u", res); return CUBEB_ERROR; } @@ -1456,7 +1455,7 @@ opensl_configure_playback(cubeb_stream * stm, cubeb_stream_params * params) } res = (*stm->bufq)->RegisterCallback(stm->bufq, player_callback, stm); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to register bufferqueue callback. Error code: %lu", res); + LOG("Failed to register bufferqueue callback. Error code: %u", res); return CUBEB_ERROR; } @@ -1643,7 +1642,7 @@ opensl_start_player(cubeb_stream * stm) if (playerState == SL_OBJECT_STATE_REALIZED) { SLresult res = (*stm->play)->SetPlayState(stm->play, SL_PLAYSTATE_PLAYING); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to start player. Error code: %lu", res); + LOG("Failed to start player. Error code: %u", res); return CUBEB_ERROR; } } @@ -1661,7 +1660,7 @@ opensl_start_recorder(cubeb_stream * stm) (*stm->recorderItf) ->SetRecordState(stm->recorderItf, SL_RECORDSTATE_RECORDING); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to start recorder. Error code: %lu", res); + LOG("Failed to start recorder. Error code: %u", res); return CUBEB_ERROR; } } @@ -1707,7 +1706,7 @@ opensl_stop_player(cubeb_stream * stm) SLresult res = (*stm->play)->SetPlayState(stm->play, SL_PLAYSTATE_PAUSED); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to stop player. Error code: %lu", res); + LOG("Failed to stop player. Error code: %u", res); return CUBEB_ERROR; } @@ -1723,7 +1722,7 @@ opensl_stop_recorder(cubeb_stream * stm) SLresult res = (*stm->recorderItf) ->SetRecordState(stm->recorderItf, SL_RECORDSTATE_PAUSED); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to stop recorder. Error code: %lu", res); + LOG("Failed to stop recorder. Error code: %u", res); return CUBEB_ERROR; } @@ -1770,7 +1769,7 @@ opensl_destroy_recorder(cubeb_stream * stm) SLresult res = (*stm->recorderBufferQueueItf)->Clear(stm->recorderBufferQueueItf); if (res != SL_RESULT_SUCCESS) { - LOG("Failed to clear recorder buffer queue. Error code: %lu", res); + LOG("Failed to clear recorder buffer queue. Error code: %u", res); return CUBEB_ERROR; } stm->recorderBufferQueueItf = nullptr; diff --git a/media/libcubeb/src/cubeb_resampler_internal.h b/media/libcubeb/src/cubeb_resampler_internal.h @@ -497,7 +497,7 @@ public: void drop_audio_if_needed() { - size_t available = samples_to_frames(delay_input_buffer.length()); + uint32_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); diff --git a/media/libcubeb/src/cubeb_wasapi.cpp b/media/libcubeb/src/cubeb_wasapi.cpp @@ -765,7 +765,7 @@ public: LPCWSTR device_id) { LOG("endpoint: Audio device default changed flow=%d role=%d " - "new_device_id=%ws.", + "new_device_id=%S.", flow, role, device_id); /* we only support a single stream type for now. */ @@ -776,7 +776,7 @@ public: DWORD last_change_ms = timeGetTime() - last_device_change; bool same_device = default_device_id && device_id && wcscmp(default_device_id.get(), device_id) == 0; - LOG("endpoint: Audio device default changed last_change=%u same_device=%d", + LOG("endpoint: Audio device default changed last_change=%lu same_device=%d", last_change_ms, same_device); if (last_change_ms > DEVICE_CHANGE_DEBOUNCE_MS || !same_device) { if (device_id) { @@ -968,7 +968,7 @@ refill(cubeb_stream * stm, void * input_buffer, long input_frames_count, cubeb_resampler_fill(stm->resampler.get(), input_buffer, &input_frames_count, dest, output_frames_needed); if (out_frames < 0) { - ALOGV("Callback refill error: %d", out_frames); + ALOGV("Callback refill error: %ld", out_frames); wasapi_state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR); return out_frames; } @@ -1281,9 +1281,11 @@ refill_callback_duplex(cubeb_stream * stm) stm->total_output_frames += output_frames; - ALOGV("in: %zu, out: %zu, missing: %ld, ratio: %f", stm->total_input_frames, - stm->total_output_frames, - static_cast<long>(stm->total_output_frames) - stm->total_input_frames, + ALOGV("in: %llu, out: %llu, missing: %ld, ratio: %f", + (unsigned long long)stm->total_input_frames, + (unsigned long long)stm->total_output_frames, + static_cast<long long>(stm->total_output_frames) - + static_cast<long long>(stm->total_input_frames), static_cast<float>(stm->total_output_frames) / stm->total_input_frames); long got; @@ -2936,7 +2938,7 @@ wasapi_stream_add_ref(cubeb_stream * stm) { XASSERT(stm); LONG result = InterlockedIncrement(&stm->ref_count); - LOGV("Stream ref count incremented = %i (%p)", result, stm); + LOGV("Stream ref count incremented = %ld (%p)", result, stm); return result; } @@ -2946,7 +2948,7 @@ wasapi_stream_release(cubeb_stream * stm) XASSERT(stm); LONG result = InterlockedDecrement(&stm->ref_count); - LOGV("Stream ref count decremented = %i (%p)", result, stm); + LOGV("Stream ref count decremented = %ld (%p)", result, stm); if (result == 0) { LOG("Stream ref count hit zero, destroying (%p)", stm);