react-native-webrtc
react-native-webrtc copied to clipboard
Possible way for use USB audio
Hello everyone, everything good?
I'm trying to implement USB audio capture, whether it's an external USB microphone or others (like a webcam).
Currently Android allows you to use (API 23) AudioRecord and specify the preferred device for recording with the setPreferredDevice
function, I see the possibility of using the read function to capture the audio buffer to be able to send it to webrtc.
The question is: how do I pass the audio stream to webrtc (like we did with the UVC video for example)?
Any ideas on how to proceed?
NOTE: the device in question appears in the code snippet below:
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
AudioDeviceInfo[] deviceInfos = audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS);
The device type is: AudioDeviceInfo.TYPE_USB_DEVICE
;
@saghul @8BallBomBom
Should be possible but also that Android api level is a little steep 🤔 That being said i'll mark this as needing research and look into it a bit more.
Should be possible but also that Android api level is a little steep 🤔 That being said i'll mark this as needing research and look into it a bit more.
In my specific case, Android is 9.0, in newer versions of Android, there is setCommunicationDevice in AudioManager that solves the problem. The problem is on "older" Androids.
Thank you for all your help in advance!
@8BallBomBom
EDIT: add link
If AudioRecord.setPreferredDevice
is all you need, then you can use the method JavaAudioDeviceModule.setPreferredInputDevice(AudioDeviceInfo preferredInputDevice)
to change this. The JavaAudioDeviceModule uses AudioRecord
under the hood, so in theory this should work.
It's much more hairy if you want to pass the bytes yourself. As far as I've looked, there's no out-of-box solution to passing in arbitrary audio bytes to webrtc.
Indeed. IIRC Gustavo sent a PR adding the same sink mechanism as video has and it got rejected 🤷
Hello, thanks for the answer.
If
AudioRecord.setPreferredDevice
is all you need, then you can use the methodJavaAudioDeviceModule.setPreferredInputDevice(AudioDeviceInfo preferredInputDevice)
to change this. The JavaAudioDeviceModule usesAudioRecord
under the hood, so in theory this should work.
Does this change directly influence WebRTC audio capture? If I make this change, will WebRTC respect and get the audio from that device?
It's much more hairy if you want to pass the bytes yourself. As far as I've looked, there's no out-of-box solution to passing in arbitrary audio bytes to webrtc.
Okay, but is there any possibility or way to do it?
In cases where it would be extremely customized, is there any way to do this?
I saw that AudioTrack has a write function that allows you to pass the bytes so that it plays them, perhaps, is there a possibility of sending a customized AudioTrack to WebRTC?
Flow would look like this: AudioRecord.read -> AudioTrack.write
Indeed. IIRC Gustavo sent a PR adding the same sink mechanism as video has and it got rejected 🤷
Does this implementation capture the audio buffer?
Can you tell me the PR number so I can analyze it?
Does this change directly influence WebRTC audio capture? If I make this change, will WebRTC respect and get the audio from that device?
Probably quicker to just link the code here:
https://github.com/jitsi/webrtc/blob/M118/sdk/android/src/java/org/webrtc/audio/WebRtcAudioRecord.java
The previously mentioned method just passes through and calls the setPreferredDevice
on the AudioRecord
. Whether that will actually fit your needs or not, I have no idea, just answering your question.
Okay, but is there any possibility or way to do it?
Not without some heavy modifications to the webrtc sdk itself. The audio stuff is all self-contained, so would need a lot of work to expose the required stuff to pass in bytes directly.
If all you need to do to get USB audio working is setting the preferred device, passing in the bytes directly is a distraction anyways.
If
AudioRecord.setPreferredDevice
is all you need, then you can use the methodJavaAudioDeviceModule.setPreferredInputDevice(AudioDeviceInfo preferredInputDevice)
to change this. The JavaAudioDeviceModule usesAudioRecord
under the hood, so in theory this should work.It's much more hairy if you want to pass the bytes yourself. As far as I've looked, there's no out-of-box solution to passing in arbitrary audio bytes to webrtc.
The function will probably work, there are even comments that the audio device can be changed after streaming has started.
The problem is that to use JavaAudioDeviceModule.setPreferredInputDevice
you need to instantiate a new class, and you would need to replace the existing one, or am I talking nonsense?
Is there a way to call this setPreferredInputDevice
without using the new JavaAudioDeviceModule
?
Sorry for my ignorance on the subject, I'm not a Java programmer, I just get by when I need.
Edit: add comment links
I managed to call JavaAudioDeviceModule.setPreferredInputDevice
.
((JavaAudioDeviceModule) webRTCModule.mAudioDeviceModule).setPreferredInputDevice(device);
However, I'm noticing one thing, the device has the following settings:
WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1601 (1601)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
AudioDevice: type=TYPE_USB_DEVICE, id=23
WebRtcAudioRecordExternal: TYPE_USB_DEVICE(in): channels=[2], encodings=[2], sample rates=[16000, 32000, 48000], id=23
And the initRecord function is static on only 1 channel, perhaps that's why the audio is not transmitted.
Below are the complete logs from the beginning of the streaming.
2023-12-19 10:01:43.122 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 ctor +3m
2023-12-19 10:01:43.124 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 addTrack +2ms
2023-12-19 10:01:43.134 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 addTrack +10ms
2023-12-19 10:01:43.144 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 createOffer +10ms
2023-12-19 10:01:43.156 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 createOffer OK +13ms
2023-12-19 10:01:43.158 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 setLocalDescription +1ms
2023-12-19 10:01:43.174 21993-22044 org.webrtc.Logging br.com.linvix.apps.selfcheckout I NetworkMonitor: Start monitoring with native observer 502444205088 fieldTrialsString:
2023-12-19 10:01:43.182 21993-22039 org.webrtc.Logging br.com.linvix.apps.selfcheckout I NetworkMonitorAutoDetect: Network handle: 432902426637 becomes available: 100
2023-12-19 10:01:43.185 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceGatheringChangeGATHERING
2023-12-19 10:01:43.186 21993-22039 org.webrtc.Logging br.com.linvix.apps.selfcheckout I NetworkMonitorAutoDetect: handle: 432902426637 capabilities changed: [ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED Unwanted: LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -65 SSID: "DESENVOLVIMENTO_5G"]
2023-12-19 10:01:43.190 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceCandidate
2023-12-19 10:01:43.190 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceCandidate
2023-12-19 10:01:43.190 21993-22039 org.webrtc.Logging br.com.linvix.apps.selfcheckout I NetworkMonitorAutoDetect: handle: 432902426637 link properties changed
2023-12-19 10:01:43.196 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 setLocalDescription OK +39ms
2023-12-19 10:01:43.243 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceCandidate
2023-12-19 10:01:43.245 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceCandidate
2023-12-19 10:01:43.274 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 setRemoteDescription +78ms
2023-12-19 10:01:43.278 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 addIceCandidate +4ms
2023-12-19 10:01:43.282 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 addIceCandidate +4ms
2023-12-19 10:01:43.284 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: initPlayout(sampleRate=48000, channels=1, bufferSizeFactor=1.0)
2023-12-19 10:01:43.285 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: byteBuffer.capacity: 960
2023-12-19 10:01:43.286 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: minBufferSizeInBytes: 7688
2023-12-19 10:01:43.286 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: createAudioTrackBeforeOreo
2023-12-19 10:01:43.287 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: nativeOutputSampleRate: 48000
2023-12-19 10:01:43.295 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: AudioTrack: session ID: 1609, channels: 1, sample rate: 48000, max gain: 1.0
2023-12-19 10:01:43.295 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: AudioTrack: buffer size in frames: 3844
2023-12-19 10:01:43.295 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: AudioTrack: buffer capacity in frames: 3844
2023-12-19 10:01:43.296 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: startPlayout
2023-12-19 10:01:43.302 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 addIceCandidate +19ms
2023-12-19 10:01:43.302 21993-23013 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: AudioTrackThread@[name=AudioTrackJavaThread, id=688]
2023-12-19 10:01:43.303 21993-23013 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioTrackExternal: doAudioTrackStateCallback: 0
2023-12-19 10:01:43.305 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onAddTrack
2023-12-19 10:01:43.306 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceCandidate
2023-12-19 10:01:43.306 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceCandidate
2023-12-19 10:01:43.313 21993-22046 com.oney.W...bRTCModule br.com.linvix.apps.selfcheckout D onIceGatheringChangeCOMPLETE
2023-12-19 10:01:43.313 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 addIceCandidate +8ms
2023-12-19 10:01:43.322 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: initRecording(sampleRate=48000, channels=1)
2023-12-19 10:01:43.322 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: byteBuffer.capacity: 960
2023-12-19 10:01:43.323 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecord.getMinBufferSize: 3840
2023-12-19 10:01:43.323 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: bufferSizeInBytes: 7680
2023-12-19 10:01:43.323 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: createAudioRecordOnMOrHigher
2023-12-19 10:01:43.346 21993-23014 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: initEncode name: OMX.qcom.video.encoder.avc type: H264 width: 640 height: 480 framerate_fps: 60 bitrate_kbps: 300 surface mode: true
2023-12-19 10:01:43.348 21993-23017 OMXClient br.com.linvix.apps.selfcheckout I IOmx service obtained
2023-12-19 10:01:43.377 21993-23014 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Format: {color-format=2130708361, i-frame-interval=3600, mime=video/avc, width=640, bitrate-mode=2, bitrate=300000, frame-rate=60.0, height=480}
2023-12-19 10:01:43.378 21993-23017 ExtendedACodec br.com.linvix.apps.selfcheckout I setupVideoEncoder()
2023-12-19 10:01:43.378 21993-23017 OMXUtils br.com.linvix.apps.selfcheckout W do not know color format 0x7fa30c04 = 2141391876
2023-12-19 10:01:43.379 21993-23017 OMXUtils br.com.linvix.apps.selfcheckout W do not know color format 0x7f000789 = 2130708361
2023-12-19 10:01:43.382 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: setPreferredDevice 23
2023-12-19 10:01:43.383 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioEffectsExternal: enable(audioSession=1617)
2023-12-19 10:01:43.384 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioEffectsExternal: AcousticEchoCanceler: was enabled, enable: true, is now: enabled
2023-12-19 10:01:43.386 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioEffectsExternal: NoiseSuppressor: was enabled, enable: true, is now: enabled
2023-12-19 10:01:43.386 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecord: session ID: 1617, channels: 1, sample rate: 48000
2023-12-19 10:01:43.386 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecord: buffer size in frames: 3840
2023-12-19 10:01:43.387 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Number of active recording sessions: 5
2023-12-19 10:01:43.387 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecordingConfigurations:
2023-12-19 10:01:43.389 21993-22045 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.389 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1073 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.390 21993-22045 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.390 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1265 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.390 21993-22045 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.390 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1489 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.390 21993-22045 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.390 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1665 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.390 21993-22045 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.390 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=385 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.391 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout W WebRtcAudioRecordExternal: Potential microphone conflict. Active sessions: 5
2023-12-19 10:01:43.391 21993-23017 ACodec br.com.linvix.apps.selfcheckout I setupAVCEncoderParameters with [profile: High] [level: Level31]
2023-12-19 10:01:43.391 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: startRecording
2023-12-19 10:01:43.391 21993-22045 AudioRecord br.com.linvix.apps.selfcheckout W dead IAudioRecord, creating a new one from start()
2023-12-19 10:01:43.393 21993-23017 ACodec br.com.linvix.apps.selfcheckout I [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
2023-12-19 10:01:43.393 21993-23017 ACodec br.com.linvix.apps.selfcheckout I setupVideoEncoder succeeded
2023-12-19 10:01:43.393 21993-23017 ExtendedACodec br.com.linvix.apps.selfcheckout I [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = 'conf', target = 13) = {
int32_t color-format = 2130708361
int32_t i-frame-interval = 3600
string mime = "video/avc"
int32_t width = 640
int32_t bitrate-mode = 2
int32_t bitrate = 300000
float frame-rate = 60.000000
int32_t height = 480
int32_t encoder = 1
}
2023-12-19 10:01:43.397 21993-23017 OMXUtils br.com.linvix.apps.selfcheckout W do not know color format 0x7f000789 = 2130708361
2023-12-19 10:01:43.404 21993-22045 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: scheduleLogRecordingConfigurationsTask
2023-12-19 10:01:43.405 21993-23025 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecordThread@[name=AudioRecordJavaThread, id=692]
2023-12-19 10:01:43.408 21993-23025 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: doAudioRecordStateCallback: START
2023-12-19 10:01:43.409 21993-23017 ExtendedACodec br.com.linvix.apps.selfcheckout W Failed to get extension for extradata parameter
2023-12-19 10:01:43.411 21993-23014 org.webrtc.Logging br.com.linvix.apps.selfcheckout I EglBase14Impl: Using OpenGL ES version 2
2023-12-19 10:01:43.416 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 ontrack +107ms
2023-12-19 10:01:43.420 21993-23014 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: updateInputFormat format: {color-transfer=3, color-format=2130708361, slice-height=480, mime=video/raw, width=640, stride=640, color-range=2, using-sw-read-often=0, color-standard=4, height=480} stride: 640 sliceHeight: 480 isSemiPlanar: true frameSizeBytes: 460800
2023-12-19 10:01:43.441 21993-22049 ReactNativeJS br.com.linvix.apps.selfcheckout I rn-webrtc:pc:DEBUG 2 setRemoteDescription OK +25ms
2023-12-19 10:01:43.506 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Number of active recording sessions: 6
2023-12-19 10:01:43.506 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecordingConfigurations:
2023-12-19 10:01:43.510 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.511 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1073 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.511 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.512 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1265 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.513 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.513 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1489 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.513 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.513 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1665 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.513 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.513 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=385 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:01:43.514 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1617 (1617)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
AudioDevice: type=TYPE_USB_DEVICE, id=23
2023-12-19 10:01:43.514 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.514 21993-23026 chatty br.com.linvix.apps.selfcheckout I uid=10107(br.com.linvix.apps.selfcheckout) WebRtcAudioReco identical 3 lines
2023-12-19 10:01:43.514 21993-23026 AudioRecor...figuration br.com.linvix.apps.selfcheckout E Couldn't find device for recording, did recording end already?
2023-12-19 10:01:43.515 21993-23026 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: verifyAudioConfig: PASS
2023-12-19 10:01:43.541 21993-23028 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Releasing MediaCodec on output thread
2023-12-19 10:01:43.557 21993-23028 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Release on output thread done
2023-12-19 10:01:43.561 21993-23030 OMXClient br.com.linvix.apps.selfcheckout I IOmx service obtained
2023-12-19 10:01:43.577 21993-23014 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Format: {color-format=21, i-frame-interval=3600, mime=video/avc, width=640, bitrate-mode=2, bitrate=300000, frame-rate=60.0, height=480}
2023-12-19 10:01:43.577 21993-23030 ExtendedACodec br.com.linvix.apps.selfcheckout I setupVideoEncoder()
2023-12-19 10:01:43.578 21993-23030 OMXUtils br.com.linvix.apps.selfcheckout W do not know color format 0x7fa30c04 = 2141391876
2023-12-19 10:01:43.578 21993-23030 OMXUtils br.com.linvix.apps.selfcheckout W do not know color format 0x7f000789 = 2130708361
2023-12-19 10:01:43.588 21993-23030 ACodec br.com.linvix.apps.selfcheckout I setupAVCEncoderParameters with [profile: High] [level: Level31]
2023-12-19 10:01:43.591 21993-23030 ACodec br.com.linvix.apps.selfcheckout I [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
2023-12-19 10:01:43.591 21993-23030 ACodec br.com.linvix.apps.selfcheckout I setupVideoEncoder succeeded
2023-12-19 10:01:43.591 21993-23030 ExtendedACodec br.com.linvix.apps.selfcheckout I [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = 'conf', target = 16) = {
int32_t color-format = 21
int32_t i-frame-interval = 3600
string mime = "video/avc"
int32_t width = 640
int32_t bitrate-mode = 2
int32_t bitrate = 300000
float frame-rate = 60.000000
int32_t height = 480
int32_t encoder = 1
}
2023-12-19 10:01:43.603 21993-23030 ExtendedACodec br.com.linvix.apps.selfcheckout W Failed to get extension for extradata parameter
2023-12-19 10:01:43.606 21993-23014 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: updateInputFormat format: {color-transfer=0, color-format=21, slice-height=480, image-data=java.nio.HeapByteBuffer[pos=0 lim=104 cap=104], mime=video/raw, width=640, stride=640, color-range=0, color-standard=0, height=480} stride: 640 sliceHeight: 480 isSemiPlanar: true frameSizeBytes: 460800
2023-12-19 10:01:43.628 21993-23036 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Config frame generated. Offset: 0. Size: 30
2023-12-19 10:01:43.633 21993-23036 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Sync frame generated
2023-12-19 10:01:43.633 21993-23036 org.webrtc.Logging br.com.linvix.apps.selfcheckout I HardwareVideoEncoder: Prepending config buffer of size 30 to output buffer with offset 0, size 4048
Note the error Couldn't find device for recording, did recording end already?
and the warning WebRtcAudioRecordExternal: Potential microphone conflict. Active sessions: 5
Any ideas on how to proceed?
Another log
2023-12-19 10:20:12.594 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: initRecording(sampleRate=48000, channels=1)
2023-12-19 10:20:12.594 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: byteBuffer.capacity: 960
2023-12-19 10:20:12.595 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecord.getMinBufferSize: 3840
2023-12-19 10:20:12.595 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: bufferSizeInBytes: 7680
2023-12-19 10:20:12.595 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: createAudioRecordOnMOrHigher
2023-12-19 10:20:12.647 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: setPreferredDevice 23
2023-12-19 10:20:12.651 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecord: session ID: 881, channels: 1, sample rate: 48000
2023-12-19 10:20:12.651 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecord: buffer size in frames: 3840
2023-12-19 10:20:12.653 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Number of active recording sessions: 7
2023-12-19 10:20:12.653 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecordingConfigurations:
2023-12-19 10:20:12.655 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1073 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.656 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1265 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.656 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1489 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.656 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1665 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.656 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=385 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.657 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=353 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.658 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=2489 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.658 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout W WebRtcAudioRecordExternal: Potential microphone conflict. Active sessions: 7
2023-12-19 10:20:12.659 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: startRecording
2023-12-19 10:20:12.678 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: scheduleLogRecordingConfigurationsTask
2023-12-19 10:20:12.679 28925-29221 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecordThread@[name=AudioRecordJavaThread, id=743]
2023-12-19 10:20:12.680 28925-29221 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: doAudioRecordStateCallback: START
2023-12-19 10:20:12.780 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Number of active recording sessions: 8
2023-12-19 10:20:12.780 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: AudioRecordingConfigurations:
2023-12-19 10:20:12.783 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1073 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.783 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1265 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.783 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1489 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.783 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=1665 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.783 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=385 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.783 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=353 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.784 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=881 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
AudioDevice: type=TYPE_USB_DEVICE, id=23
2023-12-19 10:20:12.784 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: client audio source=VOICE_COMMUNICATION, client session id=2489 (881)
Device AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
Client AudioFormat: channel count=1, channel index mask=0, channel mask=IN_MONO, encoding=PCM_16BIT, sample rate=48000
2023-12-19 10:20:12.784 28925-29222 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: verifyAudioConfig: PASS
2023-12-19 10:20:14.951 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: stopRecording
2023-12-19 10:20:14.951 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: stopThread
2023-12-19 10:20:16.951 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout E WebRtcAudioRecordExternal: Join of AudioRecordJavaThread timed out
2023-12-19 10:20:16.952 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Android SDK: 28, Release: 9, Brand: SUNMI, Device: T2s, Id: PKQ1.190414.001, Hardware: qcom, Manufacturer: SUNMI, Model: T2s, Product: T2s
2023-12-19 10:20:16.956 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Audio State: audio mode: MODE_IN_COMMUNICATION, has mic: true, mic muted: false, music active: false, speakerphone: false, BT SCO: false
2023-12-19 10:20:16.956 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Audio State:
2023-12-19 10:20:16.956 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: fixed volume=false
2023-12-19 10:20:16.962 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: STREAM_VOICE_CALL: volume=5, max=5, muted=false
2023-12-19 10:20:16.963 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: STREAM_MUSIC: volume=4, max=15, muted=false
2023-12-19 10:20:16.964 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: STREAM_RING: volume=15, max=15, muted=false
2023-12-19 10:20:16.965 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: STREAM_ALARM: volume=8, max=10, muted=false
2023-12-19 10:20:16.968 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: STREAM_NOTIFICATION: volume=15, max=15, muted=false
2023-12-19 10:20:16.970 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: STREAM_SYSTEM: volume=7, max=7, muted=false
2023-12-19 10:20:16.970 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: Audio Devices:
2023-12-19 10:20:16.970 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_BUILTIN_EARPIECE(out): channels=[1], encodings=[2], sample rates=[48000], id=2
2023-12-19 10:20:16.971 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_BUILTIN_SPEAKER(out): channels=[2], encodings=[2], sample rates=[48000], id=3
2023-12-19 10:20:16.971 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_TELEPHONY(out): channels=[1, 2], encodings=[2], sample rates=[8000, 16000], id=10
2023-12-19 10:20:16.971 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_USB_DEVICE(in): channels=[2], encodings=[2], sample rates=[16000, 32000, 48000], id=23
2023-12-19 10:20:16.972 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_BUILTIN_MIC(in): channels=[1, 2, 3, 4, 6], encodings=[2], sample rates=[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000], id=16
2023-12-19 10:20:16.972 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_BUILTIN_MIC(in): channels=[1, 2, 3, 4, 6], encodings=[2], sample rates=[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000], id=17
2023-12-19 10:20:16.973 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_FM_TUNER(in): channels=[1, 2], encodings=[2], sample rates=[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000], id=13
2023-12-19 10:20:16.973 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: TYPE_TELEPHONY(in): channels=[1, 2], encodings=[2], sample rates=[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000], id=14
2023-12-19 10:20:16.974 28925-28986 org.webrtc.Logging br.com.linvix.apps.selfcheckout I WebRtcAudioRecordExternal: releaseAudioResources
2023-12-19 10:20:16.975 28925-29221 org.webrtc.Logging br.com.linvix.apps.selfcheckout E WebRtcAudioRecordExternal: AudioRecord.read failed: 0
2023-12-19 10:20:22.771 28925-29221 org.webrtc.Logging br.com.linvix.apps.selfcheckout E WebRtcAudioRecordExternal: AudioRecord.stop failed: null
Try JavaAudioDeviceModule.setUseStereoInput(true)
.
setUseStereoInput
The setUseStereoInput function can only be used with the static Builder class, unfortunately you can't use it (or I'm talking nonsense).
I'm thinking about an alternative, I don't know if it's possible and viable.
What if, we pass a customized AudioTrack to WebRTC?
This way, audio can be captured in any form via stream, from any record device, bypassing the Android's audio control.
It is possible to capture the audio from this webcam on this device that I am using because this apk (USB Camera) do it.
I can't capture the audio, maybe it was a mistake on my part.
I'm thinking about an alternative, I don't know if it's possible and viable.
What if, we pass a customized AudioTrack to WebRTC?
This way, audio can be captured in any form via stream, from any record device, bypassing the Android's audio control.
It is possible to capture the audio from this webcam on this device that I am using because this apk (USB Camera) do it.
I can't capture the audio, maybe it was a mistake on my part.
I think I said that up there, my bad, just trying some alternative.
setUseStereoInput
The setUseStereoInput function can only be used with the static Builder class, unfortunately you can't use it (or I'm talking nonsense).
You can pass in a custom JavaAudioDeviceModule by setting WebRTCModuleOptions.audioDeviceModule
in your Application.onCreate()
(prior to react-native-webrtc initializing).
As a quick sanity check though, have you tried recording from your USB device through AudioRecord
in a plain non React-native Android app? I have a sort of test project here which I used for testing recording audio (it plays back any recorded audio). I think it could be easily adapted to test whether your USB device properly records through AudioRecord
(the fact that the previous logs had Couldn't find device for recording, did recording end already?
worries me about the viability of AudioRecord).
setUseStereoInput
The setUseStereoInput function can only be used with the static Builder class, unfortunately you can't use it (or I'm talking nonsense).
You can pass in a custom JavaAudioDeviceModule by setting
WebRTCModuleOptions.audioDeviceModule
in yourApplication.onCreate()
(prior to react-native-webrtc initializing).As a quick sanity check though, have you tried recording from your USB device through
AudioRecord
in a plain non React-native Android app? I have a sort of test project here which I used for testing recording audio (it plays back any recorded audio). I think it could be easily adapted to test whether your USB device properly records throughAudioRecord
(the fact that the previous logs hadCouldn't find device for recording, did recording end already?
worries me about the viability of AudioRecord).
I'll do this audio recording test with your project to check
Any updates on this? Keeping open for now.