Skip to content

Commit

Permalink
AudioDeviceModule: added stop/start methods for playout/recording
Browse files Browse the repository at this point in the history
  • Loading branch information
devopvoid committed Oct 28, 2021
1 parent 1d69449 commit 7070622
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
32 changes: 32 additions & 0 deletions webrtc-jni/src/main/cpp/include/JNI_AudioDeviceModule.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions webrtc-jni/src/main/cpp/src/JNI_AudioDeviceModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,30 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_init
}
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_stopPlayout
(JNIEnv* env, jobject caller)
{
webrtc::AudioDeviceModule* audioModule = GetHandle<webrtc::AudioDeviceModule>(env, caller);
CHECK_HANDLE(audioModule);

if (audioModule->StopPlayout() != 0) {
env->Throw(jni::JavaError(env, "Stop playout failed"));
return;
}
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_startPlayout
(JNIEnv* env, jobject caller)
{
webrtc::AudioDeviceModule* audioModule = GetHandle<webrtc::AudioDeviceModule>(env, caller);
CHECK_HANDLE(audioModule);

if (audioModule->StartPlayout() != 0) {
env->Throw(jni::JavaError(env, "Start playout failed"));
return;
}
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_initRecording
(JNIEnv * env, jobject caller)
{
Expand All @@ -54,6 +78,30 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_init
}
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_stopRecording
(JNIEnv* env, jobject caller)
{
webrtc::AudioDeviceModule* audioModule = GetHandle<webrtc::AudioDeviceModule>(env, caller);
CHECK_HANDLE(audioModule);

if (audioModule->StopRecording() != 0) {
env->Throw(jni::JavaError(env, "Stop recording failed"));
return;
}
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_startRecording
(JNIEnv* env, jobject caller)
{
webrtc::AudioDeviceModule* audioModule = GetHandle<webrtc::AudioDeviceModule>(env, caller);
CHECK_HANDLE(audioModule);

if (audioModule->StartRecording() != 0) {
env->Throw(jni::JavaError(env, "Start recording failed"));
return;
}
}

JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_getPlayoutDevices
(JNIEnv* env, jobject caller)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ public AudioDeviceModule(AudioLayer audioLayer) {

public native void initPlayout();

public native void stopPlayout();

public native void startPlayout();

public native void initRecording();

public native void stopRecording();

public native void startRecording();

public native List<AudioDevice> getPlayoutDevices();

public native List<AudioDevice> getRecordingDevices();
Expand Down

0 comments on commit 7070622

Please sign in to comment.