Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get remoteParticipant audioBuffer because i want to convert PCM Buffer? #518

Open
liuyang2211 opened this issue Dec 4, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@liuyang2211
Copy link

How to get remoteParticipant audioBuffer because i want to convert PCM Buffer?

@liuyang2211 liuyang2211 added the enhancement New feature or request label Dec 4, 2024
@hiroshihorie
Copy link
Member

hiroshihorie commented Dec 4, 2024

You can call add(audioRenderer:) on RemoteAudioTrack and you will receive PCM audio buffer on the AudioRenderer protocol.

@objc
public protocol AudioRenderer {
    @objc
    func render(pcmBuffer: AVAudioPCMBuffer)
}

@liuyang2211
Copy link
Author

Thanks , but when I implemented the protocol, it only output a CMSampleBuffer and did not provide AVAudioPCMBuffer

sampleBuffer = CMSampleBuffer 0x101e180c0 retainCount: 3 allocator: 0x203b33c70
invalid = NO
dataReady = YES
makeDataReadyCallback = 0x0
makeDataReadyRefcon = 0x0
formatDescription = <CMAudioFormatDescription 0x300b94f00 [0x203b33c70]> {
mediaType:'soun'
mediaSubType:'lpcm'
mediaSpecific: {
ASBD: {
mSampleRate: 48000.000000
mFormatID: 'lpcm'
mFormatFlags: 0xc
mBytesPerPacket: 2
mFramesPerPacket: 1
mBytesPerFrame: 2
mChannelsPerFrame: 1
mBitsPerChannel: 16 }
cookie: {(null)}
ACL: {单声道}
FormatList Array: {
Index: 0
ChannelLayoutTag: 0x640001
ASBD: {
mSampleRate: 48000.000000
mFormatID: 'lpcm'
mFormatFlags: 0xc
mBytesPerPacket: 2
mFramesPerPacket: 1
mBytesPerFrame: 2
mChannelsPerFrame: 1
mBitsPerChannel: 16 }}
}
extensions: {(null)}
}
sbufToTrackReadiness = 0x0
numSamples = 480
outputPTS = {351840/48000 = 7.330}(based on cachedOutputPresentationTimeStamp)
sampleTimingArray[1] = {
{PTS = {351840/48000 = 7.330}, DTS = {INVALID}, duration = {1/48000 = 0.000}},
}
dataBuffer = {
CMBlockBuffer 0x30088a250 totalDataLength: 960 retainCount: 1 allocator: 0x203b33c70 subBlockCapacity: 2
[0] 960 bytes @ offset 0 Memory Block 0x101e15db0, 960 bytes (allocator 0x203b33c70)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants