ao_coreaudio_exclusive: check format explicitly on change notifcation

This should for now be equivalent; it's merely more explicit and will
be required if we add PCM support.

Note that the property listeners actually tell you what property
exactly changed, but resolving the current listener mess would be too
hard. So check for changes manually.

(cherry picked from commit 382434d45a)
This commit is contained in:
wm4 2015-04-29 23:08:16 +02:00 committed by Diogo Franco (Kovensky)
parent 8bcd9ea671
commit 63402eb1dd
1 changed files with 11 additions and 6 deletions

View File

@ -357,12 +357,17 @@ static OSStatus render_cb_digital(
// Check whether we need to reset the digital output stream. // Check whether we need to reset the digital output stream.
if (p->stream_asbd_changed) { if (p->stream_asbd_changed) {
p->stream_asbd_changed = 0; AudioStreamBasicDescription f;
if (!p->reload_requested && ca_stream_supports_digital(ao, p->stream)) { OSErr err = CA_GET(p->stream, kAudioStreamPropertyPhysicalFormat, &f);
p->reload_requested = true; CHECK_CA_WARN("could not get stream format");
ao_request_reload(ao); if (err == noErr && ca_asbd_equals(&p->stream_asbd, &f))
MP_INFO(ao, "Stream format changed! Reloading.\n"); p->stream_asbd_changed = 0;
} }
if (p->stream_asbd_changed && !p->reload_requested) {
p->reload_requested = true;
ao_request_reload(ao);
MP_INFO(ao, "Stream format changed! Reloading.\n");
} }
return noErr; return noErr;