Posts

Post not yet marked as solved
0 Replies
1.6k Views
I'm trying to send the audio track in the webrtc app. I create the audio track like this: private var factory: RTCPeerConnectionFactory = RTCPeerConnectionFactory(encoderFactory: RTCDefaultVideoEncoderFactory(), decoderFactory: RTCDefaultVideoDecoderFactory()) .... let audioTrack = factory.audioTrack(withTrackId: "ARDAMSa0") if mediaStream == nil { self.mediaStream = self.factory.mediaStream(withStreamId: "0") } self.mediaStream.addAudioTrack(audioTrack) Then I add it to peerConnection the usual way. The problem is my audio starts with some delay (2 seconds). I hear it on another peer in almost 2 seconds. Video starts immediately. The connection is perfect. I see an error log: [aurioc] AURemoteIO.cpp:1128 failed: -66635 (enable 3, outf< 1 ch, 48000 Hz, Int16> inf< 1 ch, 48000 Hz, Int16>) In the SDP offer I see that the audio codec is "opus", channels=2, clockRate=48000, which seems completely fine. Question: Is this opus codec is a problem for iOS? is there any extra RTCAudioSession steps I have to do to be able to start the audio immediately? I tried: RTCAudioSession.sharedInstance().setPreferredIOBufferDuration(0.005) Also I tried setting RTCAudioSession to various categories. Nothing helps. There's still a lag at the start. I'm not even sure what it's potentially connected with. I'm testing on iPhone 11, 12, iOS 15.6.1. Tried multiple webrtc branches. (m88, m90+), all the same. Any ideas appreciated. Thanks
Posted Last updated
.