iPhone/iPad札记2012/03/11 - 1 音频,混音


1. conference音频问题总结

* 音频双向都通过,但不稳定,时好时坏(录音只成功过一次,播放曾有过连续工作20-30分钟一切正常的记录,但重启系统后就出现问题)

    Q Action: to see how often the callback would be called ?

        A: playing: 10 ms, recording 3ms 


* 是否应该使用Audio Unit而非Audio Queue来实现VOIP功能?

     # 据资料说,Audio Queue Service的callback访问时间在0.5秒以上

     # Audio Unit资料说它比较适用于需要low-lantency的音频应用,如VOIP( used high-priority thread)

      REFERENCE: iOS provides audio processing plug-ins that support mixing, equalization, format conversion, and realtime input/output for recording, playback, offline rendering, and live conversation such as for VoIP (Voice over Internet Protocol). 

* 一个新的思路:

      # 另起一个thread去读session层的audio data,并把它们放进一个queue

      # Audio Queue callback从新的queue里拿数据去放

*实验:

      #为什么iOS主线程readAudioData会有问题,而单独的thread则没有问题?

      # 在windows/Android环境里重现相关speex的问题

*Audio Engine

      #审阅相关代码

 *明天建立一个内网上的测试环境,杜绝公网上的网络状况的影响

  * 还可以做的尝试:把Speex换成G711


 

2. MixerHost sample code 

configureAndInitializeAudioProcessingGraph

registration as follows 

        // Setup the struture that contains the input render callback 

        AURenderCallbackStruct inputCallbackStruct;

        inputCallbackStruct.inputProc        = &inputRenderCallback;

        inputCallbackStruct.inputProcRefCon  = soundStructArray;

  ^ this is an array of sound data 

        // Set a callback for the specified node's specified input

        result = AUGraphSetNodeInputCallback (

                     processingGraph,

                     mixerNode,

                     busNumber,

                     &inputCallbackStruct

                 );


sound struct 

typedef struct {


    BOOL                 isStereo;           // set to true if there is data in the audioDataRight member

    UInt32               frameCount;         // the total number of frames in the audio data

    UInt32               sampleNumber;       // the next audio sample to play

    AudioUnitSampleType  *audioDataLeft;     // the complete left (or mono) channel of audio data read from an audio file

    AudioUnitSampleType  *audioDataRight;    // the complete right channel of audio data read from an audio file

    

} soundStruct, *soundStructPtr;


3. Reading "Audio Unit " related guides - Component Service Reference 


* AURenderCallback 


typedef OSStatus (*AURenderCallback) (
   void                        *inRefCon,
   AudioUnitRenderActionFlags  *ioActionFlags,
   const AudioTimeStamp        *inTimeStamp,
   UInt32                      inBusNumber,
   UInt32                      inNumberFrames,
   AudioBufferList             *ioData
);

inRefCon

Custom data that you provided when registering your callback with the audio unit.


4. Test555程序

* 试验callback被回调的频率


    Q Action: to see how often the callback would be called ?

        A: playing: 10 ms, recording 3ms 


    Result: 

notification: Invalid mode encountered. The stream is corrupted.

2012-03-11 10:52:10.209 test555[324:207] AQBufferCallback...

2012-03-11 10:52:10.219 test555[324:207] AQBufferCallback...

2012-03-11 10:52:10.229 test555[324:207] AQBufferCallback...

2012-03-11 10:52:10.239 test555[324:207] AQBufferCallback...


[Session started at 2012-03-11 10:58:34 +0800.]

2012-03-11 10:58:34.707 test555[368:7303] InputBufferHandler...

2012-03-11 10:58:34.710 test555[368:7303] audio data sent to audio engine...

2012-03-11 10:58:34.710 test555[368:7303] InputBufferHandler...

2012-03-11 10:58:34.712 test555[368:7303] audio data sent to audio engine...

2012-03-11 10:58:34.713 test555[368:7303] InputBufferHandler...

2012-03-11 10:58:34.714 test555[368:7303] audio data sent to audio engine...

2012-03-11 10:58:34.715 test555[368:7303] InputBufferHandler...

2012-03-11 10:58:34.717 test555[368:7303] audio data sent to audio engine...



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值