iPhone/iPad开发扎记 2012/02/21


1. playing *.pcm in iOS 

* EXC_BAD_ACCESS 

http://www.cocoachina.com/macdev/objc/2011/0219/2661.html


Q:设置NSZombieEnabled后,仍然没有crash的线索。


* thought: 

可能是因为audio queue buffer没有初始化造成的。

see the following article: http://www.cnblogs.com/lovecode/archive/2011/11/14/2249021.html

reasons for EXC_BAD_ACCESS: 

1、访问受保护或者不存在的内存空间,导致返回了一个错误的指针;

2、访问未进行内存分配或初始化的内存空间;

3、在对象被释放后仍然采用原来的指针进行访问;

4、采用了[object release]释放对象,但其实对象并未采用 alloc/copy/retain 等形式进行内存分配;(这是我此次错误的原因)

5、其他不合法的内存访问方式

I guess my issue is 1st or 2nd ones. 


* handle EXC_BAD_ACCESS

# added the following statement: 

// prime the queue with some data before starting

for (int i =0; i <kNumberBuffers; ++i) {

AudioQueueAllocateBuffer(mQueue,MAX_BYTES_BUFFER, &mBuffers[i]); // added by frank.zou on 2012/02/21 Q: why no this before ?

AQBufferCallback (this, mQueue, mBuffers[i]);

   ^ Why not AQBufferPrime(...) ? 2012/03/12 

}


still the error EXC_BAD_ACCESS, but it is about memcpy(...) in readAudioDataPackets() now. 

// copy all data to audioData buffer 

memcpy(audioData, buffer, (size_t)numBytes);


* found out that numBytes is a pointer, changes as follows: 

memcpy(audioData, buffer, (size_t)*numBytes);

                                   ^ done !


note: still some noise need to be taken care of. 


Q: Why SpeakHere samples does not init Audio Queue buffer ?


2. study view related stuff for iOS 

Camera Programming Topics for iOS 


* something related 

Image Picker Controller 

AV Foundation framework 

Assets Library 




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值