Open
Conversation
The current implementation assumes exclusive control over the microphone. My proposal gives the option to a consumer application using webrtc to have control of the audio, being the microphone or something else
Contributor
|
Hi @Hector-IoT, sorry for the delayed response. You can create this PR to the GetStream/webrtc repository, as this repository mirrors the native code from it. Once you re-create a PR to the webrtc repository, we will kindly review your PR again soon. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
The current implementation assumes exclusive control over the microphone. My proposal gives the option to a consumer application using webrtc to have control of the audio, being the microphone or something else.
My custom application requires to record audio from the microphone at all times and sometimes connect to webrtc, for this my main application needs to handle the microphone data to record and send over webrtc at the same time. There is a sample ready callback I could use for getting the audio data but that is only available in the middle of a webrtc connection.
🛠 Implementation details
The changes are in JavaAudioDeviceModule and WebRtcAudioRecord class, when useExternalAudioInputBuffer is enabled the AudioRecordThread is not running. For this to work the consumer application will have to:
1- set useExternalAudioInputBuffer true and pass in the external buffer to use when creating JavaAudioDeviceModule
2- notify about new data being ready on that buffer
✍️ Explain examples
audioDeviceModule = JavaAudioDeviceModule.builder(ContextHelper.context).setUseExternalAudioInputBuffer(true)
.setExternalAudioInputBuffer(byteBuffer)
.createAudioDeviceModule()
audioDeviceModule.notifyExternalDataIsRecorded(bytesRead, captureTimeNs)