Open grebulon opened 2 years ago
The native cc code for DataIsRecorded is defined as:
{"nativeDataIsRecorded", "(IJ)V", reinterpret_cast<void*>(&webrtc::AudioRecordJni::DataIsRecorded)}};
JNI_FUNCTION_ALIGN void JNICALL AudioRecordJni::DataIsRecorded(JNIEnv* env, jobject obj, jint length, jlong nativeAudioRecord)
The arguments are: jint length, jlong nativeAudioRecord
It is called twice:
From: ./mediasoup-client/deps/webrtc/src/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java - as:
private native void nativeDataIsRecorded(int bytes, long nativeAudioRecord);
From: ./mediasoup-client/deps/webrtc/src/sdk/android/src/java/org/webrtc/audio/WebRtcAudioRecord.java - as:
private native void nativeDataIsRecorded(long nativeAudioRecordJni, int bytes);
In the second case, the arguments are reversed: long nativeAudioRecordJni, int bytes.
Same goes for GetPlayoutData:
{"nativeGetPlayoutData", "(IJ)V", reinterpret_cast<void*>(&webrtc::AudioTrackJni::GetPlayoutData)}};
JNI_FUNCTION_ALIGN void JNICALL AudioTrackJni::GetPlayoutData(JNIEnv* env, jobject obj, jint length, jlong nativeAudioTrack)
Called properly from: ./mediasoup-client/deps/webrtc/src/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java - as:
private native void nativeGetPlayoutData(int bytes, long nativeAudioRecord);
From: ./mediasoup-client/deps/webrtc/src/sdk/android/src/java/org/webrtc/audio/WebRtcAudioTrack.java - as (wrong order):
private static native void nativeGetPlayoutData(long nativeAudioTrackJni, int bytes);
I'm using this library successfully, but sometimes get these two crashes indicating that there are missing native JNI functions:
First: org.webrtc.voiceengine.WebRtcAudioRecord.nativeDataIsRecorded
Second: org.webrtc.voiceengine.WebRtcAudioTrack.nativeGetPlayoutData (already reported)