From 95d4375ac83c20b9450302ddc4edc9ffe6c7135d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 7 Oct 2014 13:58:03 +0200 Subject: [PATCH] Make the FilePlayer to choose the default sound card for Android --- coreapi/linphonecore_jni.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 2b8fce197..ceccb5889 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -5288,7 +5288,18 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphonePlayer_close(JNIEnv *env, } JNIEXPORT jlong JNICALL Java_org_linphone_core_LinphoneCore_createPlayer(JNIEnv *env, jobject jobj, jlong ptr) { - return (jlong)linphone_core_create_file_player((LinphoneCore *)ptr, NULL, NULL); + MSSndCard *snd_card = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get()); + if(snd_card == NULL) { + ms_error("No default playback sound card found"); + return 0; + } + LinphonePlayer *player = linphone_core_create_file_player((LinphoneCore *)ptr, snd_card, NULL); + if(player == NULL) { + ms_error("Fails to create a player"); + return 0; + } else { + return (jlong)player; + } } JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCore_destroyPlayer(JNIEnv *env, jobject jobj, jlong playerPtr) {