Research & Development
Text taken from: http://www.piemontewireless.net/PJSip155_and_iPhoneSDK312
Thanks to huge work of PJSip team and to Samuel Vinson for iphonesound.c code.
Checkout the latest svn trunk version of PJSip from here:
http://svn.pjsip.org/repos/pjproject/trunk
or download the latest PJSIP from here:
http://www.pjsip.org/download.htm
First step, you need to patches some files in pjproject:
Step 1: aconfigure.ac
In aconfigure.ac file add the lines below displayed with ‘+’. Of course copy without ‘+’
if test “$enable_sound” = “no”; then
true;
else
case $target in
+ arm-apple-darwin*)
+ LIBS=”$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox”
+ ac_pjmedia_snd=iphone
+ AC_MSG_RESULT([Checking sound device backend... AudioQueue])
+ ;;
*darwin*)
LIBS=”$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox”
if test “`uname -r`” = “6.8″; then
Step 2: build/rules.mak
In rules.mak modify, remove lines with ‘-’ and add lines with ‘+’:
$(LIB): $(OBJDIRS) $(OBJS) $($(APP)_EXTRA_DEP)
if test ! -d $(LIBDIR); then $(subst @@,$(subst /,$(HOST_PSEP),$(LIBDIR)),$(HOST_MKDIR)); fi
- $(AR) $(LIB) $(OBJS)
- $(RANLIB) $(LIB)
+ $(RANLIB) -static -o $(LIB) $(OBJS)
Step 3: pjlib/include/pj/config_site.h
It can be necessary to define some macro. For example :
#undef PJ_HAS_FLOATING_POINT
#define PJ_HAS_FLOATING_POINT 1
/* SRTP has not been ported to iPhone yet */
# undef PJMEDIA_HAS_SRTP
# define PJMEDIA_HAS_SRTP 0
/* Disable some codecs for now */
# define PJMEDIA_HAS_GSM_CODEC 1
# define PJMEDIA_HAS_L16_CODEC 0
# define PJMEDIA_HAS_ILBC_CODEC 0
# define PJMEDIA_HAS_SPEEX_CODEC 0
# define PJMEDIA_HAS_G722_CODEC 0
#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
Step 4: pjmedia/build/os-auto.mak.in
In os-auto.mak.in, add the line with ‘+’
# – ds: Win32 DirectSound (dsound.c)
+# – iphone: iPhone AudioQueue (iphonesound.c)
# – null: Null sound device (nullsound.c)
and
export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
endif
+#
+# iPod/iPhone
+#
+ifeq ($(AC_PJMEDIA_SND),iphone)
+export CFLAGS += -DPJMEDIA_AUDIO_LEG_HAS_AUDIOQUEUE=1 -DPJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE=1
+endif
+
#
# Null sound device
Step 6: Makefile
In Makefile (located at the root), add the line with ‘+’
-DIRS = pjlib pjlib-util pjnath third_party pjmedia pjsip pjsip-apps
+DIRS = pjlib pjlib-util pjnath third_party pjmedia pjsip
Step 7: pjmedia/build/Makefile
export PJMEDIA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
alaw_ulaw.o alaw_ulaw_table.o bidirectional.o clock_thread.o codec.o \
conference.o conf_switch.o delaybuf.o echo_common.o \
echo_port.o echo_suppress.o endpoint.o errno.o \
g711.o jbuf.o master_port.o mem_capture.o mem_player.o \
null_port.o plc_common.o port.o splitcomb.o \
resample_resample.o resample_libsamplerate.o \
resample_port.o rtcp.o rtcp_xr.o rtp.o \
sdp.o sdp_cmp.o sdp_neg.o session.o silencedet.o \
- sound_legacy.o sound_port.o stereo_port.o \
+ iphonesound.o sound_port.o stereo_port.o \
stream.o tonegen.o transport_adapter_sample.o \
transport_ice.o transport_loop.o \
transport_srtp.o transport_udp.o \
wav_player.o wav_playlist.o wav_writer.o wave.o \
wsola.o
# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
#
-TARGETS := pjmedia pjmedia-audiodev pjmedia-codec pjsdp pjmedia-test
+TARGETS := pjmedia pjmedia-audiodev pjmedia-codec pjsdp
all: $(TARGETS)
Step 8: pjmedia/src/pjmedia-audiodev/legacy_dev.c
In legacy_dev.c, add the line with ‘+’
return status;
}
*p_aud_strm = &strm->base;
+ (*p_aud_strm)->op = &stream_op;
return PJ_SUCCESS;
}
Step 9: pjmedia/src/pjmedia-audiodev/audiodev.c
pjmedia_aud_dev_factory* pjmedia_symb_mda_factory(pj_pool_factory *pf);
#endif
+#if PJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE
+pjmedia_aud_dev_factory* pjmedia_legacy_factory(pj_pool_factory *pf);
+#endif
+
#define MAX_DRIVERS 16
#define MAX_DEVS 64
#if PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA
aud_subsys.drv[aud_subsys.drv_cnt++].create = &pjmedia_symb_mda_factory;
#endif
+#if PJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE
+ aud_subsys.drv[aud_subsys.drv_cnt++].create = &pjmedia_legacy_factory;
+#endif
/* Initialize each factory and build the device ID list */ Download iphonesound.c Download from http://siphon.googlecode.com/files/iphonesound-20091226.c and rename in pjmedia/src/pjmedia/iphonesound.c Step 10: Configuration Generate configuration script autoconf aconfigure.ac > aconfigure Step 11: Compilation iPhone SDK doesn’t provide some programs without version number, so we create symbolic link. We should test before create link, but we are very lazy. Copy the lines below in file with name like compile.sh in the root of pjsip. #!/bin/sh export DEV=/Developer/Platforms/iPhoneOS.platform/Developer pushd ${DEV}/usr/bin export PATH=${DEV}/usr/bin:${PATH} export CFLAGS=”-O2 -arch armv6 -isysroot ${SDK}” export LDFLAGS=”-O2 -arch armv6 -isysroot ${SDK}” export CPP=”${DEV}/usr/bin/cpp” ./aconfigure –host=arm-apple-darwin9 –disable-speex-aec \ make dep We must not forget to change access right to allow execution. We can run compile.sh after some minutes pjsip is compiled. Thanks to Simone, for this wonderful guide. Text taken from: http://www.piemontewireless.net/PJSip155_and_iPhoneSDK312 Regards
for (i=0; i
export SDK=${DEV}/SDKs/iPhoneOS2.1.sdk
ln -s arm-apple-darwin9-gcc-4.0.1 arm-apple-darwin9-gcc
ln -s arm-apple-darwin9-g++-4.0.1 arm-apple-darwin9-g++
ln -s ranlib arm-apple-darwin9-ranlib
popd
–disable-speex-codec –disable-l16-codec –disable-g722-codec \
–disable-ilbc-codec –disable-ssl
make
Syed Arsalan Pervez aka SAP
Alessandro
March 16th, 2010 at 7:27 am
Hello, I followed the instructions to compile PJSIP but after executing:
./aconfigure –host=arm-apple-darwin9 –disable-speex-aec –disable-speex-codec –disable-l16-codec –disable-g722-codec –disable-ilbc-codec –disable-ssl
I get the following output:
aconfigure: WARNING: If you wanted to set the –build type, don’t use –host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type… i386-apple-darwin9.8.0
checking host system type… arm-apple-darwin9
checking target system type… arm-apple-darwin9
checking for arm-apple-darwin9-gcc… arm-apple-darwin9-gcc
checking for C compiler default output file name…
aconfigure: error: C compiler cannot create executables
See `config.log’ for more details.
And looking into the config.log the problem seems to be here:
aconfigure:2326: checking for C compiler default output file name
aconfigure:2353: arm-apple-darwin9-gcc -O2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk -O2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk conftest.c >&5
ld: warning: -force_cpusubtype_ALL will become unsupported for ARM architectures
ld: warning: in /usr/lib/crt1.o, missing required architecture arm in file
ld: warning: in /usr/lib/libgcc_s.1.dylib, missing required architecture arm in file
ld: warning: in /usr/lib/libSystem.dylib, missing required architecture arm in file
ld: could not find entry point “start” (perhaps missing crt1.o)
collect2: ld returned 1 exit status
aconfigure:2356: $? = 1
aconfigure:2394: result:
aconfigure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME “pjproject”
| #define PACKAGE_TARNAME “pjproject”
| #define PACKAGE_VERSION “1.x”
| #define PACKAGE_STRING “pjproject 1.x”
| #define PACKAGE_BUGREPORT “”
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
aconfigure:2401: error: C compiler cannot create executables
I’m not an expert but it looks like a generic C compiler error (maybe some missing files or links?) and not a PJSIP specific issue. I’m working on a Mac Os X 10.5.8 with IPhoneSDK 3.1.4 (gcc 4.2.1). Any idea about how i can proceed?
Thanks
Alessandro
Brad
April 7th, 2010 at 1:09 pm
So far I have been able to get the library to compile just fine. The only issue now is to enable sound. Would like to use g711/PCM or GSM. By the looks of it both should be enabled by the looks of the code from the trunk and the compilation guide. Am I wrong with this assumption? Is there anything else the I need to do to enable these codecs.
Thanks again for posting your howto.
Brad
sunglasses shop
May 31st, 2010 at 2:19 pm
nice share, good
article, very usefull for me…thank you
CNA Practice Test
June 1st, 2010 at 9:31 pm
Keep up the good work, I like your writing.
study abroad scholarship
June 2nd, 2010 at 11:43 pm
Great information! I’ve been looking for something like this for a while now. Thanks!
Christian Louboutin
June 8th, 2010 at 9:51 am
Yes… i also really like to visit new place, your idea is good.
cheap mbt shoes
July 9th, 2010 at 4:49 pm
Hey I think you have a great blog going here, I found it on Bing and plan on returning regularly for the information that you all are providing.