iPhone hard crash + some build instructions for the sake of google

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

 



Ok. I've got a build up for the iphone using the ipodsound.c method  
with the 1.0.3 codebase. I've added a short routine as follows....

PJ_DEF(void) interruptionListenerCallback(    void *    inClientData,
						  UInt32    inInterruptionState)
{
		//Put something here later.
                //Handle stuff like people plugging in headphones etc.
}
PJ_DEF(pj_status_t) ipodsound_device_init() {
        OSStatus status;
	status = AudioSessionInitialize (NULL,  NULL,    
interruptionListenerCallback, 	NULL );
	PJ_LOG(1, (THIS_FILE, "AudioSessionInitialise status %d", status));
	UInt32 category = kAudioSessionCategory_PlayAndRecord;
	status = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,  
sizeof(category), &category);
	PJ_LOG(1, (THIS_FILE, "AudioSessionSetProperty status %d", status));
	status = AudioSessionSetActive(true);
	PJ_LOG(1, (THIS_FILE, "AudioSessionSetActive status %d", status));
	return status;
}



that is called before anything, and that seems to solve a problem with  
the device audio initialization.

My compile script is as follows, since nobody seems to be uploading  
particularly useful ones.

#!/bin/sh
find ./ -name "*.depend" | xargs rm -Rf
find ./ -name "*.o" | xargs rm -Rf
find ./ -name "*.a" | xargs rm -Rf

export DEV=/Developer/Platforms/iPhoneOS.platform/Developer
export SDK=${DEV}/SDKs/iPhoneOS3.0.sdk

pushd ${DEV}/usr/bin
ln -s arm-apple-darwin9-gcc-4.2.1 arm-apple-darwin9-gcc
ln -s arm-apple-darwin9-g++-4.2.1 arm-apple-darwin9-g++
ln -s ranlib arm-apple-darwin9-ranlib
popd

#change the -gstabs+ -Oo to just -O2 (or whatever) to remove xcode  
debug compatibility.

export CFLAGS="-gstabs+ -O0 -arch armv6 -isysroot ${SDK} \
         -I${SDK}/SDKs/iPhoneOS3.0.sdk/usr/include/gcc/darwin/4.2.1 \
-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ 
iPhoneOS3.0.sdk/System/Library/Frameworks/ \
          -F${SDK}/System/Library/Frameworks"

export LDFLAGS="-O0 -arch armv6 -isysroot${SDK}\
         -F${SDK}/System/Library/Frameworks"

export CPP="${DEV}/usr/bin/cpp"

export PATH=${DEV}/usr/bin:${PATH}

unexpand build/rules.mak
make distclean
autoconf aconfigure.ac > aconfigure

./aconfigure --host=arm-apple-darwin9 --disable-speex-aec \
    --disable-speex-codec --disable-l16-codec --disable-g722-codec \
    --disable-ilbc-codec # 2>&1 | more

unexpand build/rules.mak
echo "Stage #1"
make dep #2>&1 | grep [Ee]rror  #uncomment this to filter out cruft  
for xcode
echo "Stage #2"
make #2>&1 | grep [Ee]rror #uncomment this to filter out cruft for  
xcode.

The instructions are roughly as per the Siphon wiki, but some mangling  
might be needed of those instructions for linking.

Note you should comment out the SETJMP line in os_darwinwhateveritis  
to get it to not crap itself when linking into your xcode stuff.

There might be some toolchain issues requiring some ln tomfoolery, but  
thats all documented on the net. Be aware you might need to copy some  
headers around as the sdk is missing a few crucial ones that ARE in  
the simulator.

the -gstabs+ stuff lets you get sane output from gdb inside xcode.

If you add the script to xcode as an external

ANYWAY. . . . .

When I make a call, I get  voice transmitted to the far end, but not  
recieving any audio. After about 3 seconds that voice gets jittery and  
then the whole phone locks up hard.

I'm having issues trying to debug this, as I really have no idea how  
to get the phone to eject a core dump, the logs really are not useful,  
the thing just refuses to cooperate with instruments or shark, and  
thus I really don't know how to find out whats going haywire.

I'll note two other things. SipPhone works beautifully. Siphon seems  
to have no sound. Perhaps the Siphon guys should look into that code I  
posted up the top.  btw It'd be cool if you guys could post your pjsip  
directory with your modifications and build script. That would be  
*very* instructive.

With the script above, the phone DOES build in such a way that GDB can  
interrogate the library on the iphone, but I'm still trying to divine  
a strategy to get the phone to chill out when it gets wonky and let me  
try and work out whats going wrong.

I note that the sinewave test indicates audio out DOES work, it  
suggests thus that with that ammendment I posted the ipodsound driver  
does work, so I *think* the ipodsound driver works.

I'm getting this when I run the pjsua code (The Its a trap! is a  
deactivated breakpoint I've added with a log message to indicate where  
it would normally fire)

  22:12:48.715    ipodsound.c  AudioSessionInitialise status 0
  22:12:48.737    ipodsound.c  AudioSessionSetProperty status 0
  22:12:48.848    ipodsound.c  AudioSessionSetActive status 0
  22:12:48.934 os_core_unix.c  pjlib 1.0.3 for POSIX initialized
  22:12:49.036 sip_endpoint.c  Creating endpoint instance...
  22:12:49.047          pjlib  select() I/O Queue created (0x831614)
  22:12:49.047 sip_endpoint.c  Module "mod-msg-print" registered
  22:12:49.048 sip_transport.  Transport manager created.
  22:12:49.051 sip_endpoint.c  Module "mod-tsx-layer" registered
  22:12:49.051 sip_endpoint.c  Module "mod-stateful-util" registered
  22:12:49.052 sip_endpoint.c  Module "mod-ua" registered
  22:12:49.054 sip_endpoint.c  Module "mod-100rel" registered
  22:12:49.055 sip_endpoint.c  Module "mod-pjsua" registered
  22:12:49.056 sip_endpoint.c  Module "mod-invite" registered
  22:12:49.061          pjlib  select() I/O Queue created (0x830214)
  22:12:49.067 sip_endpoint.c  Module "mod-evsub" registered
  22:12:49.069 sip_endpoint.c  Module "mod-presence" registered
  22:12:49.070 sip_endpoint.c  Module "mod-refer" registered
  22:12:49.070 sip_endpoint.c  Module "mod-pjsua-pres" registered
  22:12:49.071 sip_endpoint.c  Module "mod-pjsua-im" registered
  22:12:49.072 sip_endpoint.c  Module "mod-pjsua-options" registered
  22:12:49.073   pjsua_core.c  1 SIP worker threads created
  22:12:49.073   pjsua_core.c  pjsua version 1.0.3 for arm-apple- 
darwin9 initialized
  22:12:49.094   pjsua_core.c  SIP UDP socket reachable at 10.1.1.4:5060
  22:12:49.096    udp0x855a00  SIP UDP transport started, published  
address is 10.1.1.4:5060
  22:12:49.109  pjsua_media.c  RTP socket reachable at 10.1.1.4:4000
  22:12:49.113  pjsua_media.c  RTCP socket reachable at 10.1.1.4:4001
  22:12:49.123  pjsua_media.c  RTP socket reachable at 10.1.1.4:4002
  22:12:49.126  pjsua_media.c  RTCP socket reachable at 10.1.1.4:4003
  22:12:49.134  pjsua_media.c  RTP socket reachable at 10.1.1.4:4004
  22:12:49.137  pjsua_media.c  RTCP socket reachable at 10.1.1.4:4005
  22:12:49.146  pjsua_media.c  RTP socket reachable at 10.1.1.4:4006
  22:12:49.149  pjsua_media.c  RTCP socket reachable at 10.1.1.4:4007
2009-07-26 22:12:49.152 sipContract[157:207] Status = 0
2009-07-26 22:12:49.181 sipContract[157:207] Here we go now!
  22:12:49.209    pjsua_acc.c  Account sip:iphone at shayneoneilldevelopment.com 
  added with id 0
  22:12:49.232    pjsua_acc.c  Registration sent
  22:12:50.349    pjsua_acc.c  sip:iphone at shayneoneilldevelopment.com:  
registration success, status=200 (OK), will re-register in 300 seconds
  22:12:50.349    pjsua_acc.c  Keep-alive timer started for acc 0,  
destination:174.143.243.107:5060, interval:15s
2009-07-26 22:12:59.656 sipContract[157:207] RINGING sip:2001 at shayneoneilldevelopment.com
  22:12:59.663  pjsua_media.c  pjsua_set_snd_dev(): attempting to open  
devices @16000 Hz
  22:12:59.674    ipodsound.c  clock rate 16000
  22:12:59.675    ipodsound.c  pjmedia_snd_stream_start : play back  
starting...
  22:13:00.240    ipodsound.c  Allocated 0 buffer , status code 0
  22:13:00.243    ipodsound.c  Enqueued with result 0
  22:13:00.244    ipodsound.c  Allocated 1 buffer , status code 0
  22:13:00.245    ipodsound.c  Enqueued with result 0
  22:13:00.247    ipodsound.c  Allocated 2 buffer , status code 0
  22:13:00.247    ipodsound.c  Enqueued with result 0
  22:13:00.249    ipodsound.c  Allocated 3 buffer , status code 0
  22:13:00.250    ipodsound.c  Enqueued with result 0
  22:13:00.251    ipodsound.c  Allocated 4 buffer , status code 0
  22:13:00.252    ipodsound.c  Enqueued with result 0
  22:13:00.253    ipodsound.c  Allocated 5 buffer , status code 0
  22:13:00.254    ipodsound.c  Enqueued with result 0
  22:13:00.261    ipodsound.c  New thread!
  22:13:00.265     ec0x44aef0  Echo suppressor created,  
clock_rate=16000, channel=1, samples per frame=320, tail length=200  
ms, latency=20 ms
  22:13:00.266   pjsua_call.c  Making call with acc #0 to sip:2001 at shayneoneilldevelopment.com
  22:13:00.362     ec0x44aef0  Underflow, buf_cnt=0, will generate 1  
frame
  22:13:00.552  pjsua_media.c  Media index 0 selected for call 0
  22:13:00.573            APP  Call 0 state=CALLING
  22:13:01.101            APP  Call 0 state=CALLING
  22:13:02.121    ipodsound.c  Its a trap!
  22:13:03.111            APP  Call 0 state=EARLY
  22:13:04.141    ipodsound.c  Its a trap!
  22:13:04.569     ec0x44aef0  Underflow, buf_cnt=0, will generate 1  
frame
  22:13:05.306   sound_port.c  EC suspended because of inactivity
  22:13:06.141    ipodsound.c  Its a trap!
  22:13:08.136    ipodsound.c  Its a trap!
  22:13:10.137    ipodsound.c  Its a trap!
  22:13:10.997            APP  Call 0 state=CONNECTING
  22:13:11.002   strm0x87fd74  VAD temporarily disabled
  22:13:11.005   strm0x87fd74  Encoder stream started
  22:13:11.005   strm0x87fd74  Decoder stream started
  22:13:11.006  pjsua_media.c  Media updates, stream #0: GSM (sendrecv)
  22:13:11.007   conference.c  Port 1 (sip:2001@**account details  
deleted**) transmitting to port 0 (iPod Sound Device)
  22:13:11.007   conference.c  Port 0 (iPod Sound Device) transmitting  
to port 1 (sip:2001@**account details deleted**)
  22:13:11.009            APP  Call 0 state=CONFIRMED
(Phone goes haywire at about this point)

Can anyone suggest a strategy to try and track down this bug? I really  
just don't know where to start looking.

Thanks, and I hope these instructions I've posted help people navigate  
the confusing lack of documentation on the net. Be aware they should  
be read in conjunction with the siphon pj build documentation :)

Shayne.

===================================
Shayne O'Neill Development
Mobile, Web and Business process integration.
shayne.oneill at gmail.com 0400247091
Ask me about how Alfresco can help your business grow.




[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