livekit / client-sdk-unity

Official Unity SDK for LiveKit
https://livekit.io
40 stars 15 forks source link

RTC EchoCancellation does not work #60

Open c4zhutia opened 1 month ago

c4zhutia commented 1 month ago

Hello,

I have an agent and a participant in the room, and the participant can talk to the agent and the agent will talk back to the participant. However, if a participant is using speaker inside of earphone, the voice of agent will be recorded by microphone and send the voice to agent back. Once the agent hear the voice, it will stop current conversation and instantly talk back to the participant. This kind of ping-pong situation makes my app totally unusable.

I have checked that the newAudioSource.Options.EchoCancellation is set to true. It seems like it does not work.

ds199895 commented 3 weeks ago

For me i comment these code 图片 and in the livekitSample class i add the type of microphone when create rtcSource in the pulishMicrophone function 图片 and then it works well and no echoes. Maybe it is the problem of sampleRate, but I am not very familiar with audio. I'm glad to discuss any further.

c4zhutia commented 2 weeks ago

Thank you. Did you test the echo on andriod? or IOS? I found the code: image Only on IOS, DefaultMirophoneSampleRate differs from DefaultSampleRate.