iPhone/iPad开发札记 2012/03/09 音频

来源:互联网 发布:ubuntu mysql 路径 编辑:程序博客网 时间:2024/06/05 22:56


1. 后续工作

* 解决按hear钮按下后,event处理时间太长

* 解决有时听不见声音的问题

* 整理代码

* 声音采集


2. 听不见声音

error in console: 

notification: Invalid mode encountered. The stream is corrupted.


notification: More than two wideband layers found. The stream is corrupted.

notification: More than two wideband layers found. The stream is corrupted.

notification: More than two wideband layers found. The stream is corrupted.

notification: More than two wideband layers found. The stream is corrupted.

notification: More than two wideband layers found. The stream is corrupted.

notification: More than two wideband layers found. The stream is corrupted.


似乎与speex, see this: 

http://www.google.com.hk/search?hl=zh-CN&source=hp&q=%22More+than+two+wideband+layers+found.The+stream+is+corrupted.%22&btnG=Google+搜索&meta=&gbv=2&oq=%22More+than+two+wideband+layers+found.The+stream+is+corrupted.%22&aq=f&aqi=&aql=&gs_sm=s&gs_upl=1579l6797l0l8219l5l5l0l0l0l0l0l0ll0l0


strange issue: all threads not seen inside XCode !!!

    A: 难道XCode环境有问题?


* 曾经将几个*.a文件替换,声音开始正常,误以为*.a损坏,但过一会又出现问题。

* 将buffer改成320*40以后,曾经稳定运行过20*2分钟,后又再次出问题。


3. hear event 


4. 声音采集


*程序crash

#4104 0x0024a3b2 in CJniConfInstance::onOpenAudioConfirm at jniConfInstance.cpp:349
#4105 0x0024a3b2 in CJniConfInstance::onOpenAudioConfirm at jniConfInstance.cpp:349
#4106 0x0024a3b2 in CJniConfInstance::onOpenAudioConfirm at jniConfInstance.cpp:349
#4107 0x0024a3b2 in CJniConfInstance::onOpenAudioConfirm at jniConfInstance.cpp:349
#4108 0x0024a3b2 in CJniConfInstance::onOpenAudioConfirm at jniConfInstance.cpp:349


#10454 0x0024a3b2 in CJniConfInstance::onOpenAudioConfirm at jniConfInstance.cpp:349
#10455 0x00227d87 in CAudioSession::HandlePassOrBackMicro at audiosess.cpp:515
#10456 0x002295dd in CAudioSession::OnReceiveData at audiosess.cpp:383
#10457 0x001f82d9 in CConfSession::OnReceiveData at confsession.cpp:514
#10458 0x001c99a4 in CConfAudioSession::OnReceiveData at audiosession.cpp:78
#10459 0x001d3820 in CConference::HandleSessApplicationData at conference.cpp:1978
#10460 0x001e110a in CConference::OnReceiveData at conference.cpp:1347
#10461 0x001cf22c in CConfConnection::OnReceiveData at confconnection.cpp:169
#10462 0x001a9b86 in CRtIMConnection::OnReceive at cmimconn.cpp:890
#10463 0x000f78bd in CRtEventOnReceive::OnEventFire at RtTransportThreadProxy.cpp:375
#10464 0x00175857 in CRtEventQueueBase::ProcessOneEvent at RtEventQueueBase.cpp:229
#10465 0x001758d6 in CRtEventQueueBase::ProcessEvents at RtEventQueueBase.cpp:216
#10466 0x001844ec in CRtThreadTask::OnThreadRun at RtThreadTask.cpp:110
#10467 0x0024f973 in CJniConfInstanceMgr::StartRtThread at JniConfInstanceMgr.cpp:46
#10468 0x0024fe7e in StartRtThread at JniConfInstanceMgr.cpp:13
#10469 0x00014191 in -[test555ViewController CreatedThread] at test555ViewController.mm:81
#10470 0x00703cf4 in -[NSThread main]
#10471 0x00703c80 in __NSThread__main__
#10472 0x97e4b259 in _pthread_start
#10473 0x97e4b0de in thread_start

Q:似乎JNI的C代码中有递归调用,造成stack溢出。

    A: 的确如此! 2012/03/11


*小结一下:

打开音频,需要做以下几件事:

#在客户端上授权(?)

#在本地调用openAudio(JniInterface.h)通知服务器打开音频上传通道

#服务器返回openAudioConfirm

# 底层通过回调onOpenAudioConfirm(presentInterface.h)通知上层(应该是一个异步动作,并且在另一个线程中)


* 发送音频数据的stack

#00x00016715 in AQRecorder::MyInputBufferHandler at AQRecorder.mm:123
#1 0x0142f3fe in AQCallbackReceiver_InputCallback
#2 0x013c5404 in _XInputCallback
#3 0x013bdc11 in mshMIGPerform
#4 0x0166c944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
#5 0x015cccf7 in __CFRunLoopDoSource1
#6 0x015c9f83 in __CFRunLoopRun
#7 0x015c9840 in CFRunLoopRunSpecific
#8 0x015c9761 in CFRunLoopRunInMode
#9 0x01392cc0 in GenericRunLoopThread::RunLoop
#10 0x013a9139 in TRunLoop<AQClient>::Entry
#11 0x01392972 in CAPThread::Entry
#12 0x97e4b259 in _pthread_start
#13 0x97e4b0de in thread_start


Q: 声音录制只通了一次就出问题,是否与iOS buffer与 audio engine 的buffer数据类型不同有关?一个为void *,一个为unsigned char * ?