osxaudio: Bind audio device to audio unit early

We want to bind the device during open so that subsequent format queries
on the audio unit are as specific as possible from that point onwards.

https://bugzilla.gnome.org/show_bug.cgi?id=740987
This commit is contained in:
Arun Raghavan 2014-12-01 19:29:57 +05:30
parent 2d0391c6e1
commit 48872dbc56

View file

@ -1007,6 +1007,8 @@ _io_proc_spdif_stop (GstCoreAudio * core_audio)
static gboolean
gst_core_audio_open_impl (GstCoreAudio * core_audio)
{
gboolean ret;
/* The following is needed to instruct HAL to create their own
* thread to handle the notifications. */
_audio_system_set_runloop (NULL);
@ -1021,8 +1023,21 @@ gst_core_audio_open_impl (GstCoreAudio * core_audio)
* we will do input with it.
* http://developer.apple.com/technotes/tn2002/tn2091.html
*/
return gst_core_audio_open_device (core_audio, kAudioUnitSubType_HALOutput,
ret = gst_core_audio_open_device (core_audio, kAudioUnitSubType_HALOutput,
"HALOutput");
if (!ret) {
GST_DEBUG ("Could not open device");
goto done;
}
ret = gst_core_audio_bind_device (core_audio);
if (!ret) {
GST_DEBUG ("Could not bind device");
goto done;
}
done:
return ret;
}
static gboolean
@ -1124,9 +1139,6 @@ gst_core_audio_initialize_impl (GstCoreAudio * core_audio,
format.mChannelsPerFrame, caps))
goto done;
if (!gst_core_audio_bind_device (core_audio))
goto done;
if (core_audio->is_src) {
propertySize = sizeof (*frame_size);
status = AudioUnitGetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */