Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Global reference table overflow when using RawOutgoingAudioStream #1438

Open
cfagena opened this issue Oct 6, 2023 · 0 comments
Open
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@cfagena
Copy link

cfagena commented Oct 6, 2023

Describe the bug
After approx 15 mins, the application stops working (crashes)

Exception or Stack Trace
java_vm_ext.cc:673] JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump:
java_vm_ext.cc:673] Last 10 entries (of 51200):
java_vm_ext.cc:673] 51199: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51198: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51197: 0x13792440 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51196: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51195: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51194: 0x137911f8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51193: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51192: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51191: 0x1378ffb0 java.nio.DirectByteBuffer
java_vm_ext.cc:673] 51190: 0x12e804e8 java.nio.DirectByteBuffer
java_vm_ext.cc:673] Summary:
java_vm_ext.cc:673] 50267 of java.nio.DirectByteBuffer (1150 unique instances)
java_vm_ext.cc:673] 576 of java.lang.Class (441 unique instances)
java_vm_ext.cc:673] 58 of com.azure.android.communication.calling.Status (58 unique instances)
java_vm_ext.cc:673] 48 of com.azure.android.communication.calling.CallingCommunicationErrors (48 unique instances)
java_vm_ext.cc:673] 45 of com.azure.android.communication.calling.HandleType (45 unique instances)
java_vm_ext.cc:673] 17 of com.azure.android.communication.calling.DtmfTone (17 unique instances)
java_vm_ext.cc:673] 14 of com.azure.android.communication.calling.MediaDiagnosticType (14 unique instances)
java_vm_ext.cc:673] 13 of com.azure.android.communication.calling.VideoStreamResolution (13 unique instances)
java_vm_ext.cc:673] 10 of com.azure.android.communication.calling.CallState (10 unique instances)
java_vm_ext.cc:673] 8 of com.azure.android.communication.calling.ParticipantState (8 unique instances)

To Reproduce
Join a Teams online meeting setting a RawOutgoingAudioStream.
I followed the below instructions:
https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-raw-media-access?pivots=platform-android

Code Snippet
`override fun create() = RawOutgoingAudioStream(
RawOutgoingAudioStreamOptions().apply {
properties = RawOutgoingAudioStreamProperties()
.setFormat(AudioStreamFormat.PCM16_BIT)
.setSampleRate(AudioStreamSampleRate.HZ_44100)
.setChannelMode(AudioStreamChannelMode.STEREO)
.setBufferDuration(AudioStreamBufferDuration.MS20)
}
).apply {
val audioRecord = AudioRecord(
MediaRecorder.AudioSource.VOICE_RECOGNITION,
SAMPLE_RATE,
AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT,
expectedBufferSizeInBytes.toInt()
)
audioRecord.startRecording()

    val buffer = ByteBuffer.allocateDirect(expectedBufferSizeInBytes.toInt())
    microphoneThread = Thread {
        while (keepAlive.get()) {
            if (System.currentTimeMillis() - sendingMillis > WAIT_BEFORE_SENDING_MS) {
                audioRecord.read(buffer, buffer.capacity())
                val isMicrophoneNoisy = getRawAmplitude(buffer) > MICROPHONE_NOISE_LEVEL

                if (isMuted.value or isOnHold.value) {
                    if (_isSpeaking.value) {
                        _isSpeaking.tryEmit(false)
                    }
                } else if (_isSpeaking.value != isMicrophoneNoisy) {
                    if (isMicrophoneNoisy or (System.currentTimeMillis() - speakingMillis > MICROPHONE_NOISE_DELAY)) {
                        _isSpeaking.tryEmit(isMicrophoneNoisy)
                    }
                }

                if (isMicrophoneNoisy) {
                    speakingMillis = System.currentTimeMillis()
                }
                if (!isMuted.value and !isOnHold.value) {
                    sendRawAudioBuffer(RawAudioBuffer().setBuffer(buffer))
                }
            }
        }
    }.apply { start() }
}`

Expected behavior
Meet not to end abnormally

Screenshots
No screenshots

Setup (please complete the following information):

  • OS: Android
  • IDE : Android Studio
  • Version of the Library used: 2.3.0, 2.5.0 and 2.6.0-beta.3

Additional context
Removing the line sendRawAudioBuffer(RawAudioBuffer().setBuffer(buffer)) the crash does not happen.
Joining a call without the custom Output stream the crash either does not occur.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

1 participant