Device in question:
When establishing a WebRTC session as a master from Android 10 mobile device, the audio that should be gathered via microphone is not getting through to the viewer side. When I'm configuring transceiver on the viewer side, I do enforce both send & receive for the audio part via:
viewer.peerConnection.addTransceiver('audio', {direction: 'sendrecv'});
But clearly we can spot that:
Here's also the stats from inbound-rtc in text:
inbound-rtp (kind=audio, mid=4, ssrc=3185575416, [codec]=opus (111, minptime=10;useinbandfec=1), id=IT31A3185575416) Statistics IT31A3185575416 timestamp 2/16/2023, 2:51:44 PM ssrc 3185575416 kind audio trackId DEPRECATED_TI8 transportId T31 codecId CIT31_111_minptime=10;useinbandfec=1 [codec] opus (111, minptime=10;useinbandfec=1) mediaType audio jitter 0.063 packetsLost 0 trackIdentifier efe06737-ed24-448c-bf32-d002cef9171b mid 4 packetsReceived 170 [packetsReceived/s] 13.550688631363338 packetsDiscarded 0 fecPacketsReceived 0 fecPacketsDiscarded 0 bytesReceived 5524 [bytesReceived_in_bits/s] 3523.179044154468 headerBytesReceived 4760 [headerBytesReceived_in_bits/s] 3035.354253425388 lastPacketReceivedTimestamp 1676555504833 [lastPacketReceivedTimestamp] 2/16/2023, 2:51:44 PM jitterBufferDelay 77020.8 [jitterBufferDelay/jitterBufferEmittedCount_in_ms] 0 jitterBufferTargetDelay 270316.8 jitterBufferMinimumDelay 270240 jitterBufferEmittedCount 153600 totalSamplesReceived 665760 [totalSamplesReceived/s] 48782.47907290802 concealedSamples 505242 [concealedSamples/s] 48782.47907290802 [concealedSamples/totalSamplesReceived] 1 silentConcealedSamples 482592 [silentConcealedSamples/s] 48782.47907290802 concealmentEvents 14 insertedSamplesForDeceleration 6960 [insertedSamplesForDeceleration/s] 0 removedSamplesForAcceleration 0 [removedSamplesForAcceleration/s] 0 audioLevel 0 totalAudioEnergy 0 [Audio_Level_in_RMS] 0 totalSamplesDuration 13.869999999999749 jitterBufferFlushes* 2 delayedPacketOutageSamples* 452322 relativePacketArrivalDelay* 718.31 interruptionCount* 10 totalInterruptionDuration* 9.197 remoteId ROA3185575416
We have confirmed that microphone works on this device using third party tool microphone test app or just simply doing screen recording. We've also made sure on the master side that correct mode is set and that microphone is not muted via:
audioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); // Start by setting MODE_IN_COMMUNICATION as default audio mode. It is // required to be in this mode when playout and/or recording starts for // best possible VoIP performance. audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); audioManager.setMicrophoneMute(false);
Also using this method to check if microphone is available just before the start of the streaming returns True:
public static boolean getMicrophoneAvailable(Context context) {
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
recorder.setOutputFile(new File(context.getCacheDir(), "MediaUtil#micAvailTestFile").getAbsolutePath());
boolean available = true;
try {
recorder.prepare();
recorder.start();
}
catch (Exception exception) {
available = false;
}
recorder.release();
return available;
}
The questions are therefore the following: