зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1045018 - Make cubeb_audiounit.c use the new cubeb_set_coreaudio_notification_runloop function. r=kinetik
This commit is contained in:
Родитель
83a41ca38f
Коммит
559f8bc457
|
@ -15,6 +15,7 @@
|
|||
#include "cubeb/cubeb.h"
|
||||
#include "cubeb-internal.h"
|
||||
#include "cubeb_panner.h"
|
||||
#include "cubeb_osx_run_loop.h"
|
||||
|
||||
#if !defined(kCFCoreFoundationVersionNumber10_7)
|
||||
/* From CoreFoundation CFBase.h */
|
||||
|
@ -145,6 +146,8 @@ audiounit_init(cubeb ** context, char const * context_name)
|
|||
|
||||
ctx->limit_streams = kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber10_7;
|
||||
|
||||
cubeb_set_coreaudio_notification_runloop();
|
||||
|
||||
*context = ctx;
|
||||
|
||||
return CUBEB_OK;
|
||||
|
@ -634,20 +637,6 @@ audiounit_stream_init(cubeb * context, cubeb_stream ** stream, char const * stre
|
|||
|
||||
*stream = stm;
|
||||
|
||||
/* This is needed so that AudioUnit listeners get called on this thread, and
|
||||
* not the main thread. If we don't do that, they are not called, or a crash
|
||||
* occur, depending on the OSX version. */
|
||||
AudioObjectPropertyAddress runloop_address = {
|
||||
kAudioHardwarePropertyRunLoop,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
CFRunLoopRef run_loop = NULL;
|
||||
r = AudioObjectSetPropertyData(kAudioObjectSystemObject,
|
||||
&runloop_address,
|
||||
0, NULL, sizeof(CFRunLoopRef), &run_loop);
|
||||
|
||||
/* we dont' check the return value here, because we want to be able to play
|
||||
* even if we can't detect device changes. */
|
||||
audiounit_install_device_changed_callback(stm);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "OSXRunLoopSingleton.h"
|
||||
|
||||
void cubeb_set_coreaudio_notification_runloop()
|
||||
{
|
||||
mozilla_set_coreaudio_notification_runloop_if_needed();
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright © 2014 Mozilla Foundation
|
||||
*
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
|
||||
/* On OSX 10.6 and after, the notification callbacks from the audio hardware are
|
||||
* called on the main thread. Setting the kAudioHardwarePropertyRunLoop property
|
||||
* to null tells the OSX to use a separate thread for that.
|
||||
*
|
||||
* This has to be called only once per process, so it is in a separate header
|
||||
* for easy integration in other code bases. */
|
||||
void cubeb_set_coreaudio_notification_runloop();
|
|
@ -34,6 +34,7 @@ if CONFIG['OS_ARCH'] == 'OpenBSD':
|
|||
if CONFIG['OS_TARGET'] == 'Darwin':
|
||||
SOURCES += [
|
||||
'cubeb_audiounit.c',
|
||||
'cubeb_osx_run_loop.c'
|
||||
]
|
||||
DEFINES['USE_AUDIOUNIT'] = True
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче