mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
Merge remote-tracking branch 'zonique/osx'
This commit is contained in:
commit
ae35ec1ed5
6 changed files with 60 additions and 5 deletions
13
configure.ac
13
configure.ac
|
|
@ -169,6 +169,11 @@ AC_ARG_ENABLE([atomic-arm-memory-barrier],
|
|||
esac
|
||||
],)
|
||||
|
||||
AC_ARG_ENABLE(mac-universal,
|
||||
AS_HELP_STRING([--enable-mac-universal], [Build Mac universal binaries]),
|
||||
enable_mac_universal=$enableval, enable_mac_universal="no")
|
||||
|
||||
|
||||
AC_MSG_CHECKING([target operating system])
|
||||
case $host in
|
||||
*-*-linux*)
|
||||
|
|
@ -178,6 +183,14 @@ case $host in
|
|||
*-*-darwin*)
|
||||
AC_MSG_RESULT([darwin])
|
||||
pulse_target_os=darwin
|
||||
|
||||
if test "x$enable_mac_universal" = "xyes" ; then
|
||||
mac_version_min="-mmacosx-version-min=10.5"
|
||||
mac_arches="-arch i386 -arch x86_64"
|
||||
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
|
||||
LDFLAGS="$LDFLAGS $mac_arches $mac_sysroot $mac_version_min"
|
||||
CFLAGS="$CFLAGS $CFLAGS $mac_arches $mac_sysroot $mac_version_min"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([unknown])
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ AM_LDFLAGS+=-Wl,--export-all-symbols,--enable-auto-import -no-undefined
|
|||
WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet
|
||||
endif
|
||||
|
||||
if OS_IS_DARWIN
|
||||
AM_LDFLAGS+=-headerpad_max_install_names
|
||||
endif
|
||||
|
||||
FOREIGN_CFLAGS = -w
|
||||
MODULE_LDFLAGS = $(AM_LDFLAGS) -module -disable-static -avoid-version $(LDFLAGS_NOUNDEFINED)
|
||||
MODULE_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINOR@.la libpulsecommon-@PA_MAJORMINOR@.la libpulse.la
|
||||
|
|
@ -1542,13 +1546,13 @@ module_oss_la_LIBADD = $(MODULE_LIBADD) liboss-util.la
|
|||
|
||||
# COREAUDIO
|
||||
|
||||
module_coreaudio_detect_la_SOURCES = modules/coreaudio/module-coreaudio-detect.c
|
||||
module_coreaudio_detect_la_SOURCES = modules/macosx/module-coreaudio-detect.c
|
||||
module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \
|
||||
-Wl,-framework -Wl,Cocoa -framework CoreAudio \
|
||||
-Wl,-framework -Wl,AudioUnit -framework AudioUnit
|
||||
module_coreaudio_detect_la_LIBADD = $(MODULE_LIBADD)
|
||||
|
||||
module_coreaudio_device_la_SOURCES = modules/coreaudio/module-coreaudio-device.c
|
||||
module_coreaudio_device_la_SOURCES = modules/macosx/module-coreaudio-device.c
|
||||
module_coreaudio_device_la_LDFLAGS = $(MODULE_LDFLAGS) \
|
||||
-Wl,-framework -Wl,Cocoa -framework CoreAudio \
|
||||
-Wl,-framework -Wl,AudioUnit -framework AudioUnit
|
||||
|
|
@ -1619,7 +1623,7 @@ module_zeroconf_discover_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)
|
|||
|
||||
# Bonjour
|
||||
|
||||
module_bonjour_publish_la_SOURCES = modules/module-bonjour-publish.c
|
||||
module_bonjour_publish_la_SOURCES = modules/macosx/module-bonjour-publish.c
|
||||
module_bonjour_publish_la_LDFLAGS = $(MODULE_LDFLAGS) \
|
||||
-Wl,-framework -Wl,CoreFoundation -framework CoreFoundation
|
||||
module_bonjour_publish_la_LIBADD = $(MODULE_LIBADD)
|
||||
|
|
|
|||
|
|
@ -232,12 +232,14 @@ fail:
|
|||
|
||||
void pa__done(pa_module *m) {
|
||||
struct userdata *u;
|
||||
struct ca_device *dev = u->devices;
|
||||
struct ca_device *dev;
|
||||
AudioObjectPropertyAddress property_address;
|
||||
|
||||
pa_assert(m);
|
||||
pa_assert_se(u = m->userdata);
|
||||
|
||||
dev = u->devices;
|
||||
|
||||
property_address.mSelector = kAudioHardwarePropertyDevices;
|
||||
property_address.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
property_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
|
@ -107,6 +107,10 @@
|
|||
|
||||
#ifdef __APPLE__
|
||||
#include <xlocale.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/thread_act.h>
|
||||
#include <mach/thread_policy.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
|
|
@ -691,7 +695,39 @@ static int set_scheduler(int rtprio) {
|
|||
* the thread is already realtime, don't do anything. */
|
||||
int pa_make_realtime(int rtprio) {
|
||||
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#if defined(OS_IS_DARWIN)
|
||||
struct thread_time_constraint_policy ttcpolicy;
|
||||
uint64_t freq = 0;
|
||||
size_t size = sizeof(freq);
|
||||
int ret;
|
||||
|
||||
ret = sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0);
|
||||
if (ret < 0) {
|
||||
pa_log_info("Unable to read CPU frequency, acquisition of real-time scheduling failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pa_log_debug("sysctl for hw.cpufrequency: %llu", freq);
|
||||
|
||||
/* See http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html */
|
||||
ttcpolicy.period = freq / 160;
|
||||
ttcpolicy.computation = freq / 3300;
|
||||
ttcpolicy.constraint = freq / 2200;
|
||||
ttcpolicy.preemptible = 1;
|
||||
|
||||
ret = thread_policy_set(mach_thread_self(),
|
||||
THREAD_TIME_CONSTRAINT_POLICY,
|
||||
(thread_policy_t) &ttcpolicy,
|
||||
THREAD_TIME_CONSTRAINT_POLICY_COUNT);
|
||||
if (ret) {
|
||||
pa_log_info("Unable to set real-time thread priority (%08x).", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pa_log_info("Successfully acquired real-time thread priority.");
|
||||
return 0;
|
||||
|
||||
#elif _POSIX_PRIORITY_SCHEDULING
|
||||
int p;
|
||||
|
||||
if (set_scheduler(rtprio) >= 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue