Patch to use CoreAudio automatically on MacOS and iOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

pjsip supports coreaudio natively on Mac and iOS. But by default the 
configure script chooses portaudio library.
Here is a patch to use automatically coreaudio on MacOS and iOS.

Best regards

Samuel
-------------- next part --------------
diff --git a/aconfigure.ac b/aconfigure.ac
index be2f2ae..f49136c 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -571,6 +571,7 @@ else
  case $target in
   arm-apple-darwin*)
 	LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit"
+    ac_pjmedia_snd=coreaudio
 	AC_MSG_RESULT([Checking sound device backend... AudioUnit])
 	;;
   *darwin*)
@@ -581,7 +582,7 @@ else
 		ac_pjmedia_snd=pa_old_darwinos
 		AC_MSG_RESULT([Checking sound device backend... old coreaudio])
 	else
-		ac_pjmedia_snd=pa_darwinos
+		ac_pjmedia_snd=coreaudio
 		AC_MSG_RESULT([Checking sound device backend... coreaudio])
 	fi
 	;;
diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in
index 98ecf28..7279d5b 100644
--- a/pjmedia/build/os-auto.mak.in
+++ b/pjmedia/build/os-auto.mak.in
@@ -140,6 +140,13 @@ export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
 endif
 
 #
+# Darwin sound device
+#
+ifeq ($(AC_PJMEDIA_SND),coreaudio)
+export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 -DPJMEDIA_AUDIO_DEV_HAS_WMME=0 -DPJMEDIA_AUDIO_DEV_HAS_COREAUDIO=1
+endif
+
+#
 # Null sound device
 #
 ifeq ($(AC_PJMEDIA_SND),null)
diff --git a/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c b/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c
index d071897..a17392a 100644
--- a/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c
+++ b/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c
@@ -32,7 +32,9 @@
 
 #include <AudioUnit/AudioUnit.h>
 #include <AudioToolbox/AudioConverter.h>
-#if !COREAUDIO_MAC
+#if COREAUDIO_MAC
+    #include <CoreAudio/CoreAudio.h>
+#else  /* !COREAUDIO_MAC */
     #include <AudioToolbox/AudioServices.h>
 
     #define AudioDeviceID unsigned


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux