CMSampleBufferSetDataBufferFromAudioBufferList returning error 12731

后端 未结 1 566
借酒劲吻你
借酒劲吻你 2021-01-06 10:01

I am trying to capture app sound and pass it to AVAssetWriter as input.
I am setting callback for audio unit to get AudioBufferList.
The problem starts with conver

1条回答
  •  星月不相逢
    2021-01-06 10:38

    Since there is a similar question without answer all over the internet.
    I managed to solve it and the recording fully works.
    My problem was wrong parameter passed to CMSampleBufferCreate.
    numSamples instead of 1 should be equal to numberOfFrames.

    So the final call is:

    CMSampleBufferCreate(kCFAllocatorDefault,NULL,false,NULL,NULL,format,
                        (CMItemCount)numberOfFrames, 1, &timing, 0, NULL, &buff);
    

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