зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1877319 - Update cubeb to revision 46906c7. r=cubeb-reviewers,kinetik
Differential Revision: https://phabricator.services.mozilla.com/D200981
This commit is contained in:
Родитель
864528da90
Коммит
6d63af8a6c
|
@ -274,7 +274,7 @@ typedef enum {
|
|||
typedef struct {
|
||||
cubeb_sample_format format; /**< Requested sample format. One of
|
||||
#cubeb_sample_format. */
|
||||
uint32_t rate; /**< Requested sample rate. Valid range is [1000, 192000]. */
|
||||
uint32_t rate; /**< Requested sample rate. Valid range is [1000, 384000]. */
|
||||
uint32_t channels; /**< Requested channel count. Valid range is [1, 8]. */
|
||||
cubeb_channel_layout
|
||||
layout; /**< Requested channel layout. This must be consistent with the
|
||||
|
|
|
@ -9,8 +9,8 @@ origin:
|
|||
description: "Cross platform audio library"
|
||||
url: https://github.com/mozilla/cubeb
|
||||
license: ISC
|
||||
release: dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337 (2024-01-15T14:25:40Z).
|
||||
revision: dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337
|
||||
release: 46906c7bba281a9cc277881e9cf9e32909f8dbf2 (2024-02-07T16:57:06Z).
|
||||
revision: 46906c7bba281a9cc277881e9cf9e32909f8dbf2
|
||||
|
||||
vendoring:
|
||||
url: https://github.com/mozilla/cubeb
|
||||
|
|
|
@ -95,7 +95,7 @@ validate_stream_params(cubeb_stream_params * input_stream_params,
|
|||
XASSERT(input_stream_params || output_stream_params);
|
||||
if (output_stream_params) {
|
||||
if (output_stream_params->rate < 1000 ||
|
||||
output_stream_params->rate > 192000 ||
|
||||
output_stream_params->rate > 384000 ||
|
||||
output_stream_params->channels < 1 ||
|
||||
output_stream_params->channels > UINT8_MAX) {
|
||||
return CUBEB_ERROR_INVALID_FORMAT;
|
||||
|
@ -103,7 +103,7 @@ validate_stream_params(cubeb_stream_params * input_stream_params,
|
|||
}
|
||||
if (input_stream_params) {
|
||||
if (input_stream_params->rate < 1000 ||
|
||||
input_stream_params->rate > 192000 ||
|
||||
input_stream_params->rate > 384000 ||
|
||||
input_stream_params->channels < 1 ||
|
||||
input_stream_params->channels > UINT8_MAX) {
|
||||
return CUBEB_ERROR_INVALID_FORMAT;
|
||||
|
|
|
@ -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>
|
||||
|
@ -1760,9 +1759,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
|
||||
|
|
|
@ -377,6 +377,15 @@ cubeb_channel_to_channel_label(cubeb_channel channel)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
is_common_sample_rate(Float64 sample_rate)
|
||||
{
|
||||
/* Some commonly used sample rates and their multiples and divisors. */
|
||||
return sample_rate == 8000 || sample_rate == 16000 || sample_rate == 22050 ||
|
||||
sample_rate == 32000 || sample_rate == 44100 || sample_rate == 48000 ||
|
||||
sample_rate == 88200 || sample_rate == 96000;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
typedef UInt32 AudioDeviceID;
|
||||
typedef UInt32 AudioObjectID;
|
||||
|
@ -2502,6 +2511,12 @@ audiounit_configure_output(cubeb_stream * stm)
|
|||
return CUBEB_ERROR;
|
||||
}
|
||||
stm->output_hw_rate = output_hw_desc.mSampleRate;
|
||||
if (!is_common_sample_rate(stm->output_desc.mSampleRate)) {
|
||||
/* For uncommon sample rates, we may run into issues with the OS
|
||||
resampler if we don't do the resampling ourselves, so set the
|
||||
AudioUnit sample rate to the hardware rate and resample. */
|
||||
stm->output_desc.mSampleRate = stm->output_hw_rate;
|
||||
}
|
||||
LOG("(%p) Output device sampling rate: %.2f", stm,
|
||||
output_hw_desc.mSampleRate);
|
||||
stm->context->channels = output_hw_desc.mChannelsPerFrame;
|
||||
|
@ -2709,11 +2724,16 @@ audiounit_setup_stream(cubeb_stream * stm)
|
|||
input_unconverted_params.rate = stm->input_hw_rate;
|
||||
}
|
||||
|
||||
/* Create resampler. Output params are unchanged
|
||||
* because we do not need conversion on the output. */
|
||||
cubeb_stream_params output_unconverted_params;
|
||||
if (has_output(stm)) {
|
||||
output_unconverted_params = stm->output_stream_params;
|
||||
output_unconverted_params.rate = stm->output_desc.mSampleRate;
|
||||
}
|
||||
|
||||
/* Create resampler. */
|
||||
stm->resampler.reset(cubeb_resampler_create(
|
||||
stm, has_input(stm) ? &input_unconverted_params : NULL,
|
||||
has_output(stm) ? &stm->output_stream_params : NULL, target_sample_rate,
|
||||
has_output(stm) ? &output_unconverted_params : NULL, target_sample_rate,
|
||||
stm->data_callback, stm->user_ptr, CUBEB_RESAMPLER_QUALITY_DESKTOP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE));
|
||||
if (!stm->resampler) {
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mozilla/gtest/MozHelpers.h"
|
||||
|
||||
// #define ENABLE_NORMAL_LOG
|
||||
// #define ENABLE_VERBOSE_LOG
|
||||
#include "common.h"
|
||||
|
@ -208,8 +206,6 @@ TEST(cubeb, duplex_collection_change_no_unregister)
|
|||
cubeb * ctx;
|
||||
int r;
|
||||
|
||||
mozilla::gtest::DisableCrashReporter();
|
||||
|
||||
r = common_init(&ctx, "Cubeb duplex example with collection change");
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче