MTAudioProcessingTapRef回调调用频率

时间:2015-10-11 17:49:38

标签: ios objective-c avfoundation avplayer

我使用此代码设置MTAudioProcessingTap:

AVAssetTrack *audioTrack = [self audioTrack].assetTrack;
AVMutableAudioMixInputParameters *inputParams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:audioTrack];

MTAudioProcessingTapCallbacks callbacks;
callbacks.version = kMTAudioProcessingTapCallbacksVersion_0;
callbacks.clientInfo = (__bridge void *)(self);
callbacks.init = InitCallbackProc;
callbacks.prepare = PrepareCallbackProc;
callbacks.process = ProcessCallbackProc;
callbacks.unprepare = UnprepareCallbackProc;
callbacks.finalize = FinalizeCallbackProc;

MTAudioProcessingTapRef tap;
OSStatus err = MTAudioProcessingTapCreate(kCFAllocatorDefault, &callbacks,
                                          kMTAudioProcessingTapCreationFlag_PostEffects, &tap);
if (err || !tap)
{
    NSLog(@"Unable to create the Audio Processing Tap");
    return;
}

inputParams.audioTapProcessor = tap;

AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
audioMix.inputParameters = @[inputParams];
self.playerItem.audioMix = audioMix;

然后我每秒收到~10个ProcessCallbackProc。但我需要更多,每秒20-30。这可以通过MediaToolbox API实现吗?

0 个答案:

没有答案