Cannot customize the push voice stream
Describe the bug I am unable to hear clear sound on the device using CustomAudioSource.pushAudio, and it often reports errors
To Reproduce Steps to reproduce the behavior: The audio stream returned by calling TTS byte[] data = new byte[buffer.remaining()]; buffer.get(data); audio = ByteUtils.concat(audio, data); // play tts audio MediaManager bean = ApplicationContextUtil.getBean(MediaManager.class); CustomAudioSource customAudioSource = bean.getCustomAudioSource();
customAudioSource.pushAudio(audio, 16, 16000, 1, 160);
Expected behavior I expect the streaming voice to be played normally
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS] macos
- Version [e.g. 22] 15.6.1 (24G90)
Additional context I hope to use WebRTC Java to implement a JavaScript request for Java, and then Java calls ASR, LLM synthesizes TTS speech stream, and then plays it, similar to a robot
Frequently prompt this error
Duplicate of #118.
You are not alone running into this issue. The problem here is that you are using the CustomAudioSource from multiple threads and then you are running into race conditions as the error states. To handle the CustomAudioSource properly, please wrap its usage into a single thread.
Duplicate of #118.
You are not alone running into this issue. The problem here is that you are using the
CustomAudioSourcefrom multiple threads and then you are running into race conditions as the error states. To handle the CustomAudioSource properly, please wrap its usage into a single thread.
Thanks! I redirected to the link to see the content. I had also added synchronized before and only came to seek advice after it was not resolved. I noticed that the issue # 118 has not been resolved, and several developers have encountered this problem @devopvoid