зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689517 - Update libcubeb to 89423822. r=cubeb-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D105442
This commit is contained in:
Родитель
7142eed4fa
Коммит
8596ba9920
|
@ -642,65 +642,6 @@ TEST(cubeb, drain)
|
|||
do_drain = 0;
|
||||
}
|
||||
|
||||
TEST(cubeb, device_reset)
|
||||
{
|
||||
int r;
|
||||
cubeb * ctx;
|
||||
cubeb_stream * stream;
|
||||
cubeb_stream_params params;
|
||||
uint64_t position;
|
||||
|
||||
r = common_init(&ctx, "test_sanity");
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
ASSERT_NE(ctx, nullptr);
|
||||
|
||||
if (strcmp(cubeb_get_backend_id(ctx), "wasapi")) {
|
||||
// cubeb_stream_reset_default_device is only useful and implemented in the
|
||||
// WASAPI backend.
|
||||
return;
|
||||
}
|
||||
|
||||
params.format = STREAM_FORMAT;
|
||||
params.rate = STREAM_RATE;
|
||||
params.channels = STREAM_CHANNELS;
|
||||
params.layout = STREAM_LAYOUT;
|
||||
params.prefs = CUBEB_STREAM_PREF_NONE;
|
||||
|
||||
r = cubeb_stream_init(ctx, &stream, "test", NULL, NULL, NULL, ¶ms, STREAM_LATENCY,
|
||||
test_data_callback, test_state_callback, &dummy);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
ASSERT_NE(stream, nullptr);
|
||||
|
||||
r = cubeb_stream_start(stream);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
|
||||
uint32_t iterations = 5;
|
||||
uint64_t previous_position = 0;
|
||||
while (iterations--) {
|
||||
r = cubeb_stream_get_position(stream, &position);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
ASSERT_GE(position, previous_position);
|
||||
previous_position = position;
|
||||
delay(100);
|
||||
}
|
||||
|
||||
r = cubeb_stream_reset_default_device(stream);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
|
||||
iterations = 5;
|
||||
while (iterations--) {
|
||||
r = cubeb_stream_get_position(stream, &position);
|
||||
ASSERT_EQ(r, CUBEB_OK);
|
||||
ASSERT_GE(position, previous_position);
|
||||
previous_position = position;
|
||||
delay(100);
|
||||
}
|
||||
|
||||
cubeb_stream_stop(stream);
|
||||
cubeb_stream_destroy(stream);
|
||||
cubeb_destroy(ctx);
|
||||
}
|
||||
|
||||
TEST(cubeb, DISABLED_eos_during_prefill)
|
||||
{
|
||||
// This test needs to be implemented.
|
||||
|
|
|
@ -552,14 +552,6 @@ CUBEB_EXPORT int cubeb_stream_start(cubeb_stream * stream);
|
|||
@retval CUBEB_ERROR */
|
||||
CUBEB_EXPORT int cubeb_stream_stop(cubeb_stream * stream);
|
||||
|
||||
/** Reset stream to the default device.
|
||||
@param stream
|
||||
@retval CUBEB_OK
|
||||
@retval CUBEB_ERROR_INVALID_PARAMETER
|
||||
@retval CUBEB_ERROR_NOT_SUPPORTED
|
||||
@retval CUBEB_ERROR */
|
||||
CUBEB_EXPORT int cubeb_stream_reset_default_device(cubeb_stream * stream);
|
||||
|
||||
/** Get the current stream playback position.
|
||||
@param stream
|
||||
@param position Playback position in frames.
|
||||
|
|
|
@ -19,5 +19,5 @@ origin:
|
|||
license: "ISC"
|
||||
|
||||
# update.sh will update this value
|
||||
release: "9beb8ed0c91f1b6ed7769d2c28c94a1d78b6c6f1 (2021-02-17 10:22:19 +1300)"
|
||||
release: "8942382280721117900072945767cece14eef046 (2021-02-17 22:05:37 +1300)"
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ struct cubeb_ops {
|
|||
void (* stream_destroy)(cubeb_stream * stream);
|
||||
int (* stream_start)(cubeb_stream * stream);
|
||||
int (* stream_stop)(cubeb_stream * stream);
|
||||
int (* stream_reset_default_device)(cubeb_stream * stream);
|
||||
int (* stream_get_position)(cubeb_stream * stream, uint64_t * position);
|
||||
int (* stream_get_latency)(cubeb_stream * stream, uint32_t * latency);
|
||||
int (* stream_get_input_latency)(cubeb_stream * stream, uint32_t * latency);
|
||||
|
|
|
@ -404,20 +404,6 @@ cubeb_stream_stop(cubeb_stream * stream)
|
|||
return stream->context->ops->stream_stop(stream);
|
||||
}
|
||||
|
||||
int
|
||||
cubeb_stream_reset_default_device(cubeb_stream * stream)
|
||||
{
|
||||
if (!stream) {
|
||||
return CUBEB_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (!stream->context->ops->stream_reset_default_device) {
|
||||
return CUBEB_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return stream->context->ops->stream_reset_default_device(stream);
|
||||
}
|
||||
|
||||
int
|
||||
cubeb_stream_get_position(cubeb_stream * stream, uint64_t * position)
|
||||
{
|
||||
|
|
|
@ -1450,7 +1450,6 @@ const static struct cubeb_ops aaudio_ops = {
|
|||
/*.stream_destroy =*/aaudio_stream_destroy,
|
||||
/*.stream_start =*/aaudio_stream_start,
|
||||
/*.stream_stop =*/aaudio_stream_stop,
|
||||
/*.stream_reset_default_device =*/NULL,
|
||||
/*.stream_get_position =*/aaudio_stream_get_position,
|
||||
/*.stream_get_latency =*/aaudio_stream_get_latency,
|
||||
/*.stream_get_input_latency =*/aaudio_stream_get_input_latency,
|
||||
|
|
|
@ -1441,7 +1441,6 @@ static struct cubeb_ops const alsa_ops = {
|
|||
.stream_destroy = alsa_stream_destroy,
|
||||
.stream_start = alsa_stream_start,
|
||||
.stream_stop = alsa_stream_stop,
|
||||
.stream_reset_default_device = NULL,
|
||||
.stream_get_position = alsa_stream_get_position,
|
||||
.stream_get_latency = alsa_stream_get_latency,
|
||||
.stream_get_input_latency = NULL,
|
||||
|
|
|
@ -3618,7 +3618,6 @@ cubeb_ops const audiounit_ops = {
|
|||
/*.stream_destroy =*/ audiounit_stream_destroy,
|
||||
/*.stream_start =*/ audiounit_stream_start,
|
||||
/*.stream_stop =*/ audiounit_stream_stop,
|
||||
/*.stream_reset_default_device =*/ nullptr,
|
||||
/*.stream_get_position =*/ audiounit_stream_get_position,
|
||||
/*.stream_get_latency =*/ audiounit_stream_get_latency,
|
||||
/*.stream_get_input_latency =*/ NULL,
|
||||
|
|
|
@ -135,7 +135,6 @@ static struct cubeb_ops const cbjack_ops = {
|
|||
.stream_destroy = cbjack_stream_destroy,
|
||||
.stream_start = cbjack_stream_start,
|
||||
.stream_stop = cbjack_stream_stop,
|
||||
.stream_reset_default_device = NULL,
|
||||
.stream_get_position = cbjack_stream_get_position,
|
||||
.stream_get_latency = cbjack_get_latency,
|
||||
.stream_get_input_latency = NULL,
|
||||
|
|
|
@ -1747,7 +1747,6 @@ static struct cubeb_ops const opensl_ops = {
|
|||
.stream_destroy = opensl_stream_destroy,
|
||||
.stream_start = opensl_stream_start,
|
||||
.stream_stop = opensl_stream_stop,
|
||||
.stream_reset_default_device = NULL,
|
||||
.stream_get_position = opensl_stream_get_position,
|
||||
.stream_get_latency = opensl_stream_get_latency,
|
||||
.stream_get_input_latency = NULL,
|
||||
|
|
|
@ -1282,7 +1282,6 @@ static struct cubeb_ops const oss_ops = {
|
|||
.stream_destroy = oss_stream_destroy,
|
||||
.stream_start = oss_stream_start,
|
||||
.stream_stop = oss_stream_stop,
|
||||
.stream_reset_default_device = NULL,
|
||||
.stream_get_position = oss_stream_get_position,
|
||||
.stream_get_latency = oss_stream_get_latency,
|
||||
.stream_get_input_latency = NULL,
|
||||
|
|
|
@ -658,7 +658,6 @@ static struct cubeb_ops const sndio_ops = {
|
|||
.stream_destroy = sndio_stream_destroy,
|
||||
.stream_start = sndio_stream_start,
|
||||
.stream_stop = sndio_stream_stop,
|
||||
.stream_reset_default_device = NULL,
|
||||
.stream_get_position = sndio_stream_get_position,
|
||||
.stream_get_latency = sndio_stream_get_latency,
|
||||
.stream_set_volume = sndio_stream_set_volume,
|
||||
|
|
|
@ -718,7 +718,6 @@ static struct cubeb_ops const sun_ops = {
|
|||
.stream_destroy = sun_stream_destroy,
|
||||
.stream_start = sun_stream_start,
|
||||
.stream_stop = sun_stream_stop,
|
||||
.stream_reset_default_device = NULL,
|
||||
.stream_get_position = sun_stream_get_position,
|
||||
.stream_get_latency = sun_stream_get_latency,
|
||||
.stream_get_input_latency = NULL,
|
||||
|
|
|
@ -861,7 +861,17 @@ refill(cubeb_stream * stm, void * input_buffer, long input_frames_count,
|
|||
return out_frames;
|
||||
}
|
||||
|
||||
int wasapi_stream_reset_default_device(cubeb_stream * stm);
|
||||
int trigger_async_reconfigure(cubeb_stream * stm)
|
||||
{
|
||||
XASSERT(stm && stm->reconfigure_event);
|
||||
BOOL ok = SetEvent(stm->reconfigure_event);
|
||||
if (!ok) {
|
||||
LOG("SetEvent on reconfigure_event failed: %lx", GetLastError());
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
|
||||
/* This helper grabs all the frames available from a capture client, put them in
|
||||
* linear_input_buffer. linear_input_buffer should be cleared before the
|
||||
|
@ -890,7 +900,7 @@ bool get_input_buffer(cubeb_stream * stm)
|
|||
// Application can recover from this error. More info
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd316605(v=vs.85).aspx
|
||||
LOG("Device invalidated error, reset default device");
|
||||
wasapi_stream_reset_default_device(stm);
|
||||
trigger_async_reconfigure(stm);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -993,7 +1003,7 @@ bool get_output_buffer(cubeb_stream * stm, void *& buffer, size_t & frame_count)
|
|||
// Application can recover from this error. More info
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd316605(v=vs.85).aspx
|
||||
LOG("Device invalidated error, reset default device");
|
||||
wasapi_stream_reset_default_device(stm);
|
||||
trigger_async_reconfigure(stm);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2743,17 +2753,6 @@ int wasapi_stream_stop(cubeb_stream * stm)
|
|||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
int wasapi_stream_reset_default_device(cubeb_stream * stm)
|
||||
{
|
||||
XASSERT(stm && stm->reconfigure_event);
|
||||
BOOL ok = SetEvent(stm->reconfigure_event);
|
||||
if (!ok) {
|
||||
LOG("SetEvent on reconfigure_event failed: %lx", GetLastError());
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
return CUBEB_OK;
|
||||
}
|
||||
|
||||
int wasapi_stream_get_position(cubeb_stream * stm, uint64_t * position)
|
||||
{
|
||||
XASSERT(stm && position);
|
||||
|
@ -3253,7 +3252,6 @@ cubeb_ops const wasapi_ops = {
|
|||
/*.stream_destroy =*/ wasapi_stream_destroy,
|
||||
/*.stream_start =*/ wasapi_stream_start,
|
||||
/*.stream_stop =*/ wasapi_stream_stop,
|
||||
/*.stream_reset_default_device =*/ wasapi_stream_reset_default_device,
|
||||
/*.stream_get_position =*/ wasapi_stream_get_position,
|
||||
/*.stream_get_latency =*/ wasapi_stream_get_latency,
|
||||
/*.stream_get_input_latency =*/ wasapi_stream_get_input_latency,
|
||||
|
|
|
@ -1056,7 +1056,6 @@ static struct cubeb_ops const winmm_ops = {
|
|||
/*.stream_destroy =*/ winmm_stream_destroy,
|
||||
/*.stream_start =*/ winmm_stream_start,
|
||||
/*.stream_stop =*/ winmm_stream_stop,
|
||||
/*.stream_reset_default_device =*/ NULL,
|
||||
/*.stream_get_position =*/ winmm_stream_get_position,
|
||||
/*.stream_get_latency = */ winmm_stream_get_latency,
|
||||
/*.stream_get_input_latency = */ NULL,
|
||||
|
|
Загрузка…
Ссылка в новой задаче