Skip to content

Commit e195735

Browse files
committed
Fix issue that was brought up in the original code for audiounit
Fix compiler error..
1 parent 6758579 commit e195735

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/cubeb_audiounit.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2969,10 +2969,12 @@ static int
29692969
audiounit_stream_get_position(cubeb_stream * stm, uint64_t * position)
29702970
{
29712971
assert(stm);
2972-
if (stm->current_latency_frames > stm->frames_played) {
2972+
uint32_t latency_frames = stm->total_output_latency_frames + cubeb_resampler_latency(stm->resampler.get())
2973+
2974+
if (latency_frames > stm->frames_played) {
29732975
*position = 0;
29742976
} else {
2975-
*position = stm->frames_played - (stm->current_latency_frames + cubeb_resampler_latency(stm->resampler.get()));
2977+
*position = stm->frames_played - latency_frames;
29762978
}
29772979
return CUBEB_OK;
29782980
}

src/cubeb_wasapi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,7 @@ int wasapi_stream_get_latency(cubeb_stream * stm, uint32_t * latency)
26472647

26482648
// This happens on windows 10: no error, but always 0 for latency.
26492649
if (latency_hns == 0) {
2650-
double delay_s = current_stream_delay(stm));
2650+
double delay_s = current_stream_delay(stm);
26512651
// convert to output(mix) rate sample-frames
26522652
*latency = (delay_s * stm->output_mix_params.rate) + resample_latency;
26532653
} else {

0 commit comments

Comments
 (0)