early-access version 2820
This commit is contained in:
54
externals/cubeb/test/test_duplex.cpp
vendored
54
externals/cubeb/test/test_duplex.cpp
vendored
@@ -137,26 +137,20 @@ void device_collection_changed_callback(cubeb * context, void * user)
|
||||
" called when opening a stream";
|
||||
}
|
||||
|
||||
TEST(cubeb, duplex_collection_change)
|
||||
void
|
||||
duplex_collection_change_impl(cubeb * ctx)
|
||||
{
|
||||
cubeb *ctx;
|
||||
cubeb_stream *stream;
|
||||
cubeb_stream * stream;
|
||||
cubeb_stream_params input_params;
|
||||
cubeb_stream_params output_params;
|
||||
int r;
|
||||
uint32_t latency_frames = 0;
|
||||
|
||||
r = common_init(&ctx, "Cubeb duplex example with collection change");
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
|
||||
r = cubeb_register_device_collection_changed(ctx,
|
||||
static_cast<cubeb_device_type>(CUBEB_DEVICE_TYPE_INPUT),
|
||||
device_collection_changed_callback,
|
||||
nullptr);
|
||||
r = cubeb_register_device_collection_changed(
|
||||
ctx, static_cast<cubeb_device_type>(CUBEB_DEVICE_TYPE_INPUT),
|
||||
device_collection_changed_callback, nullptr);
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
|
||||
|
||||
std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
|
||||
cleanup_cubeb_at_exit(ctx, cubeb_destroy);
|
||||
|
||||
/* typical user-case: mono input, stereo output, low latency. */
|
||||
input_params.format = STREAM_FORMAT;
|
||||
@@ -173,13 +167,43 @@ TEST(cubeb, duplex_collection_change)
|
||||
r = cubeb_get_min_latency(ctx, &output_params, &latency_frames);
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Could not get minimal latency";
|
||||
|
||||
r = cubeb_stream_init(ctx, &stream, "Cubeb duplex",
|
||||
NULL, &input_params, NULL, &output_params,
|
||||
latency_frames, data_cb_duplex, state_cb_duplex, nullptr);
|
||||
r = cubeb_stream_init(ctx, &stream, "Cubeb duplex", NULL, &input_params, NULL,
|
||||
&output_params, latency_frames, data_cb_duplex,
|
||||
state_cb_duplex, nullptr);
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb stream";
|
||||
cubeb_stream_destroy(stream);
|
||||
}
|
||||
|
||||
TEST(cubeb, duplex_collection_change)
|
||||
{
|
||||
cubeb * ctx;
|
||||
int r;
|
||||
|
||||
r = common_init(&ctx, "Cubeb duplex example with collection change");
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
|
||||
ctx, cubeb_destroy);
|
||||
|
||||
duplex_collection_change_impl(ctx);
|
||||
r = cubeb_register_device_collection_changed(
|
||||
ctx, static_cast<cubeb_device_type>(CUBEB_DEVICE_TYPE_INPUT), nullptr,
|
||||
nullptr);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
}
|
||||
|
||||
TEST(cubeb, duplex_collection_change_no_unregister)
|
||||
{
|
||||
cubeb * ctx;
|
||||
int r;
|
||||
|
||||
r = common_init(&ctx, "Cubeb duplex example with collection change");
|
||||
ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library";
|
||||
std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
|
||||
ctx, [](cubeb * p) noexcept { EXPECT_DEATH(cubeb_destroy(p), ""); });
|
||||
|
||||
duplex_collection_change_impl(ctx);
|
||||
}
|
||||
|
||||
long data_cb_input(cubeb_stream * stream, void * user, const void * inputbuffer, void * outputbuffer, long nframes)
|
||||
{
|
||||
if (stream == NULL || inputbuffer == NULL || outputbuffer != NULL) {
|
||||
|
21
externals/cubeb/test/test_resampler.cpp
vendored
21
externals/cubeb/test/test_resampler.cpp
vendored
@@ -338,7 +338,8 @@ void test_resampler_duplex(uint32_t input_channels, uint32_t output_channels,
|
||||
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, &input_params, &output_params, target_rate,
|
||||
data_cb_resampler, (void*)&state, CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
data_cb_resampler, (void*)&state, CUBEB_RESAMPLER_QUALITY_VOIP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
|
||||
long latency = cubeb_resampler_latency(resampler);
|
||||
|
||||
@@ -484,8 +485,8 @@ TEST(cubeb, resampler_output_only_noop)
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, nullptr, &output_params, target_rate,
|
||||
test_output_only_noop_data_cb, nullptr,
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
const long out_frames = 128;
|
||||
float out_buffer[out_frames];
|
||||
long got;
|
||||
@@ -523,7 +524,8 @@ TEST(cubeb, resampler_drain)
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, nullptr, &output_params, target_rate,
|
||||
test_drain_data_cb, &cb_count,
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
|
||||
const long out_frames = 128;
|
||||
float out_buffer[out_frames];
|
||||
@@ -572,7 +574,8 @@ TEST(cubeb, resampler_passthrough_output_only)
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, nullptr, &output_params,
|
||||
target_rate, cb_passthrough_resampler_output, nullptr,
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
|
||||
float output_buffer[output_channels * 256];
|
||||
|
||||
@@ -616,7 +619,8 @@ TEST(cubeb, resampler_passthrough_input_only)
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, &input_params, nullptr,
|
||||
target_rate, cb_passthrough_resampler_input, nullptr,
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
|
||||
float input_buffer[input_channels * 256];
|
||||
|
||||
@@ -737,7 +741,8 @@ TEST(cubeb, resampler_passthrough_duplex_callback_reordering)
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, &input_params, &output_params,
|
||||
target_rate, cb_passthrough_resampler_duplex, &c,
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP,
|
||||
CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
|
||||
const long BUF_BASE_SIZE = 256;
|
||||
float input_buffer_prebuffer[input_channels * BUF_BASE_SIZE * 2];
|
||||
@@ -820,7 +825,7 @@ TEST(cubeb, resampler_drift_drop_data)
|
||||
cubeb_resampler * resampler =
|
||||
cubeb_resampler_create((cubeb_stream*)nullptr, &input_params, &output_params,
|
||||
target_rate, cb_passthrough_resampler_duplex, &c,
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP);
|
||||
CUBEB_RESAMPLER_QUALITY_VOIP, CUBEB_RESAMPLER_RECLOCK_NONE);
|
||||
|
||||
const long BUF_BASE_SIZE = 256;
|
||||
|
||||
|
Reference in New Issue
Block a user