mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-04-26 19:45:42 -04:00
dep/cubeb: Update to 85f1cf4
This commit is contained in:
parent
7daa169cda
commit
0f8f9bc052
@ -130,6 +130,7 @@ struct cubeb_stream {
|
|||||||
int64_t latest_input_latency = 0;
|
int64_t latest_input_latency = 0;
|
||||||
bool voice_input;
|
bool voice_input;
|
||||||
bool voice_output;
|
bool voice_output;
|
||||||
|
uint64_t previous_clock;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cubeb {
|
struct cubeb {
|
||||||
@ -998,6 +999,7 @@ aaudio_stream_init(cubeb * ctx, cubeb_stream ** stream,
|
|||||||
stm->state_callback = state_callback;
|
stm->state_callback = state_callback;
|
||||||
stm->voice_input = input_stream_params && !!(input_stream_params->prefs & CUBEB_STREAM_PREF_VOICE);
|
stm->voice_input = input_stream_params && !!(input_stream_params->prefs & CUBEB_STREAM_PREF_VOICE);
|
||||||
stm->voice_output = output_stream_params && !!(output_stream_params->prefs & CUBEB_STREAM_PREF_VOICE);
|
stm->voice_output = output_stream_params && !!(output_stream_params->prefs & CUBEB_STREAM_PREF_VOICE);
|
||||||
|
stm->previous_clock = 0;
|
||||||
|
|
||||||
LOG("cubeb stream prefs: voice_input: %s voice_output: %s",
|
LOG("cubeb stream prefs: voice_input: %s voice_output: %s",
|
||||||
stm->voice_input ? "true" : "false",
|
stm->voice_input ? "true" : "false",
|
||||||
@ -1238,6 +1240,11 @@ aaudio_stream_get_position(cubeb_stream * stm, uint64_t * position)
|
|||||||
// getTimestamp is only valid when the stream is playing.
|
// getTimestamp is only valid when the stream is playing.
|
||||||
// Simply return the number of frames passed to aaudio
|
// Simply return the number of frames passed to aaudio
|
||||||
*position = WRAP(AAudioStream_getFramesRead)(stream);
|
*position = WRAP(AAudioStream_getFramesRead)(stream);
|
||||||
|
if (*position < stm->previous_clock) {
|
||||||
|
*position = stm->previous_clock;
|
||||||
|
} else {
|
||||||
|
stm->previous_clock = *position;
|
||||||
|
}
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
case stream_state::INIT:
|
case stream_state::INIT:
|
||||||
assert(false && "Invalid stream");
|
assert(false && "Invalid stream");
|
||||||
@ -1252,12 +1259,15 @@ aaudio_stream_get_position(cubeb_stream * stm, uint64_t * position)
|
|||||||
aaudio_result_t res;
|
aaudio_result_t res;
|
||||||
res = WRAP(AAudioStream_getTimestamp)(stream, CLOCK_MONOTONIC, &pos, &ns);
|
res = WRAP(AAudioStream_getTimestamp)(stream, CLOCK_MONOTONIC, &pos, &ns);
|
||||||
if (res != AAUDIO_OK) {
|
if (res != AAUDIO_OK) {
|
||||||
// when we are in 'STARTING' state we try it and hope that the stream
|
// When the audio stream is not running, invalid_state is returned and we
|
||||||
// has internally started and gives us a valid timestamp.
|
// simply fall back to the method we use for non-playing streams.
|
||||||
// If that is not the case (invalid_state is returned) we simply
|
if (res == AAUDIO_ERROR_INVALID_STATE) {
|
||||||
// fall back to the method we use for non-playing streams.
|
|
||||||
if (res == AAUDIO_ERROR_INVALID_STATE && state == stream_state::STARTING) {
|
|
||||||
*position = WRAP(AAudioStream_getFramesRead)(stream);
|
*position = WRAP(AAudioStream_getFramesRead)(stream);
|
||||||
|
if (*position < stm->previous_clock) {
|
||||||
|
*position = stm->previous_clock;
|
||||||
|
} else {
|
||||||
|
stm->previous_clock = *position;
|
||||||
|
}
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1266,6 +1276,11 @@ aaudio_stream_get_position(cubeb_stream * stm, uint64_t * position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*position = pos;
|
*position = pos;
|
||||||
|
if (*position < stm->previous_clock) {
|
||||||
|
*position = stm->previous_clock;
|
||||||
|
} else {
|
||||||
|
stm->previous_clock = *position;
|
||||||
|
}
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2185,7 +2185,7 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm,
|
|||||||
|
|
||||||
void wasapi_find_matching_output_device(cubeb_stream * stm) {
|
void wasapi_find_matching_output_device(cubeb_stream * stm) {
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
cubeb_device_info * input_device = nullptr;
|
cubeb_device_info * input_device;
|
||||||
cubeb_device_collection collection;
|
cubeb_device_collection collection;
|
||||||
|
|
||||||
// Only try to match to an output device if the input device is a bluetooth
|
// Only try to match to an output device if the input device is a bluetooth
|
||||||
|
Loading…
x
Reference in New Issue
Block a user