Open liuming1989 opened 6 months ago
Hello,
You can try using echoCanceler to true in the prepareAudio method: https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/base/StreamBase.kt#L130
boolean prepared = genericStream.prepareVideo(width,height,vBitrate,rotation)&&genericStream.prepareAudio(sampleRate,isStereo,aBitrate,true); I initialize the streaming framework like this. Do you think there is any problem? Currently I play a sound stream and use the framework to push a video stream. The other party can hear the sound of the sound stream I play through the video stream.
Try to enable noiseSuppressor too. If the problem persist you can try change the audio source of the microphonemanager. using this createmicrophone method: https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/input/audio/MicrophoneManager.java#L89 You will need copy MicrophoneSource class, change createMicrophone adding other source and use this new MicrophoneSource modified in the constructor. Sources documentation: https://developer.android.com/reference/android/media/MediaRecorder.AudioSource
I will implement a way to do it without copy the class manually and change it but you can start your tests this way for now.
Okay, thank you. If it's convenient, please try the usage scenario I mentioned and see how to solve such problems. My original framework used MediaRecorder AudioSource VOICE-COMMUNICATION audio source, but there may be very low streaming sound on some tablets, which is why we found the framework you developed. Currently, everything in the framework is very good, except for the issue of echo in my current usage scenario
Hello,
Can you give me a code example to test it? I'm not sure the way you are doing that communication to fully reproduce the case. For now, I added a way to modify MediaRecorder.AudioSource to MicrophoneSource: https://github.com/pedroSG94/RootEncoder/commit/b3e367551187b63de2d4f234a0030c405229ad45
BidirectionalDemo.zip This is the demo I made, which has the function of streaming and playing videos. You can use two mobile phones to enter the corresponding address and manually enable the permission. I did not take any action I used RootEncoder as the framework for streaming videos The framework for playing videos is my own
Hope you can solve the problem, thank you
Hello,
I was testing the app but I'm not able to reproduce the echo problem. Remember that if you have the both phones nearby you will have echo because the audio provided by one device is captured by the other device. You should test it with 2 persons and with a distance that you are sure that the microphone is not able to detect the audio from the other device producing echo.
Also, you can use this gradle:
implementation 'com.github.pedroSG94.RootEncoder:library:b3e3675511'
And change the microphone media source like this (try to test all values):
genericStream = new GenericStream(LiveStreamActivity.this,this, new Camera2Source(this), new MicrophoneSource(MediaRecorder.AudioSource.VOICE_CALL));
implementation 'com.github.pedroSG94.RootEncoder:library:2.4.5'
implementation 'com.github.pedroSG94.RootEncoder:library:b3e3675511'
![Uploading 11111.jpg…]() Are they cited together?
No, remove the first (2.4.5) and use only the other
Scenario: I use GenericStream of the "RootEncoder" framework to push a video to the server, and play an audio stream in the push stream scenario. The other party plays the video I pushed and pushes an audio stream. It can be understood as a one-to-one call scenario. Question: Currently, when the other party speaks, he can hear his own echo. Is there any way to eliminate this echo?