1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-02 21:12:23 +00:00

ao_coreaudio: store asbd only when selected

Previous code needlessly stored the input asbd before actually testing it's
support against the hardware.
This commit is contained in:
Stefano Pigozzi 2013-07-11 23:53:21 +02:00
parent 4e0618dab9
commit 5a195845e3

View File

@ -560,8 +560,6 @@ static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd)
if (!is_alive)
ca_msg(MSGL_WARN, "device is not alive\n");
d->stream_asbd = asbd;
p->is_digital = 1;
err = ca_lock_device(p->device, &d->hog_pid);
@ -612,8 +610,7 @@ static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd)
// select the digital format that has exactly the same
// samplerate. If an exact match cannot be found, select
// the format with highest samplerate as backup.
if (formats[j].mFormat.mSampleRate ==
d->stream_asbd.mSampleRate) {
if (formats[j].mFormat.mSampleRate == asbd.mSampleRate) {
req_rate_format = j;
break;
} else if (max_rate_format < 0 ||