diff options
author | Brian Smith <brian@dbsoft.org> | 2022-04-26 09:34:34 -0500 |
---|---|---|
committer | Brian Smith <brian@dbsoft.org> | 2022-04-26 10:19:00 -0500 |
commit | 378738aaa9924d0b95e2c57f27cbad2b2e644282 (patch) | |
tree | 34ce9c4ce3995576604fb4bc47d9405e661daf39 /media | |
parent | 82f11ad8aaeff395629c3a3f72ece43712fd8e72 (diff) | |
download | uxp-378738aaa9924d0b95e2c57f27cbad2b2e644282.tar.gz |
Issue #1829 - Revert “Issue #1751 - Remove Mac code behind MOZ_WIDGET_TOOLKIT == 'cocoa’”
This reverts commit 1fe9c19305dadf2d5bcaa0e589fcd250389dfa8a.
Diffstat (limited to 'media')
-rw-r--r-- | media/libcubeb/src/cubeb_osx_run_loop.c | 11 | ||||
-rw-r--r-- | media/libcubeb/src/cubeb_osx_run_loop.h | 22 | ||||
-rw-r--r-- | media/libcubeb/src/moz.build | 4 |
3 files changed, 37 insertions, 0 deletions
diff --git a/media/libcubeb/src/cubeb_osx_run_loop.c b/media/libcubeb/src/cubeb_osx_run_loop.c new file mode 100644 index 0000000000..0ba9536560 --- /dev/null +++ b/media/libcubeb/src/cubeb_osx_run_loop.c @@ -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(); +} diff --git a/media/libcubeb/src/cubeb_osx_run_loop.h b/media/libcubeb/src/cubeb_osx_run_loop.h new file mode 100644 index 0000000000..78cd68d09b --- /dev/null +++ b/media/libcubeb/src/cubeb_osx_run_loop.h @@ -0,0 +1,22 @@ +/* + * 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. */ +#if defined(__cplusplus) +extern "C" { +#endif + +void cubeb_set_coreaudio_notification_runloop(); + +#if defined(__cplusplus) +} +#endif diff --git a/media/libcubeb/src/moz.build b/media/libcubeb/src/moz.build index c21cc873db..65aaf7256a 100644 --- a/media/libcubeb/src/moz.build +++ b/media/libcubeb/src/moz.build @@ -55,6 +55,10 @@ if CONFIG['OS_TARGET'] == 'Darwin': 'cubeb_audiounit.cpp', 'cubeb_resampler.cpp' ] + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + SOURCES += [ + 'cubeb_osx_run_loop.c', + ] DEFINES['USE_AUDIOUNIT'] = True if CONFIG['OS_TARGET'] == 'WINNT': |