semaphore_osx: change mp_sem_timedwait to mp_time

This commit is contained in:
Kacper Michajłow
2023-10-22 07:33:19 +02:00
committed by Dudemanguy
parent f659a60dfa
commit 729f2fed2c
3 changed files with 18 additions and 24 deletions

View File

@@ -500,7 +500,7 @@ bool ca_change_physical_format_sync(struct ao *ao, AudioStreamID stream,
/* The AudioStreamSetProperty is not only asynchronous,
* it is also not Atomic, in its behaviour. */
struct timespec timeout = mp_rel_time_to_timespec(2.0);
int64_t wait_until = mp_time_ns() + MP_TIME_S_TO_NS(2);
AudioStreamBasicDescription actual_format = {0};
while (1) {
err = CA_GET(stream, kAudioStreamPropertyPhysicalFormat, &actual_format);
@@ -511,7 +511,7 @@ bool ca_change_physical_format_sync(struct ao *ao, AudioStreamID stream,
if (format_set)
break;
if (mp_sem_timedwait(&wakeup, &timeout)) {
if (mp_sem_timedwait(&wakeup, wait_until)) {
MP_VERBOSE(ao, "reached timeout\n");
break;
}