How do you release an MTAudioProcessingTap?

后端 未结 1 1726
误落风尘
误落风尘 2020-12-05 16:52

The header file for MTAudioProcessingTap says that its initialization and prepare callbacks will be balanced by unprepare and finalize callbacks. However, in Apple\'s exampl

相关标签:
1条回答
  • 2020-12-05 17:08

    I had the same problem. To make it work, I had to reset the player item's audioMix, the tap processor (MYAudioTapProcessor in Apple's sample project) and manually release the MTAudioProcessingTapRef:

    MTAudioProcessingTapRef tap = ((AVMutableAudioMixInputParameters *)_audioTapProcessor.audioMix.inputParameters[0]).audioTapProcessor;
    _player.currentItem.audioMix = nil;
    _audioTapProcessor = nil;
    CFRelease(tap);
    

    This causes the finalize callback to be invoked.

    Edit: Seems like the CFRelease is not required, see comments.

    0 讨论(0)
提交回复
热议问题