Commit 114c163b authored by Andrea Gianarda's avatar Andrea Gianarda
Browse files

Add function to be called from Java code to trigger a device ID update -...

Add function to be called from Java code to trigger a device ID update - stream destruction and creation
parent 570a08d5
...@@ -57,6 +57,10 @@ struct AAudioOutputContext { ...@@ -57,6 +57,10 @@ struct AAudioOutputContext {
ms_flow_controlled_bufferizer_set_flow_control_interval_ms(&buffer, flowControlIntervalMs); ms_flow_controlled_bufferizer_set_flow_control_interval_ms(&buffer, flowControlIntervalMs);
} }
void setDeviceChanged(bool val) {
deviceChanged = val;
}
void setDefaultDeviceId(std::string streamTypeStr) { void setDefaultDeviceId(std::string streamTypeStr) {
// env is an object in C++ // env is an object in C++
JNIEnv *env = ms_get_jni_env(); JNIEnv *env = ms_get_jni_env();
...@@ -213,6 +217,16 @@ void setDeviceIdInStreamBuilder(AAudioOutputContext *octx, AAudioStreamBuilder * ...@@ -213,6 +217,16 @@ void setDeviceIdInStreamBuilder(AAudioOutputContext *octx, AAudioStreamBuilder *
AAudioStreamBuilder_setDeviceId(builder, octx->deviceId); AAudioStreamBuilder_setDeviceId(builder, octx->deviceId);
} }
static void updateReceiverContextPtr(AAudioOutputContext *octx) {
// Get ContextClass
// Get mMediastreamReceiver
// Get BroadcastClass
// Set context pointer to mMediastreamReceiver
}
static void aaudio_player_init(AAudioOutputContext *octx) { static void aaudio_player_init(AAudioOutputContext *octx) {
AAudioStreamBuilder *builder; AAudioStreamBuilder *builder;
aaudio_result_t result = AAudio_createStreamBuilder(&builder); aaudio_result_t result = AAudio_createStreamBuilder(&builder);
...@@ -261,6 +275,8 @@ static void aaudio_player_init(AAudioOutputContext *octx) { ...@@ -261,6 +275,8 @@ static void aaudio_player_init(AAudioOutputContext *octx) {
ms_message("[AAudio] Player stream started"); ms_message("[AAudio] Player stream started");
} }
updateReceiverContextPtr(octx);
AAudioStreamBuilder_delete(builder); AAudioStreamBuilder_delete(builder);
} }
...@@ -404,3 +420,13 @@ MSFilter *android_snd_card_create_writer(MSSndCard *card) { ...@@ -404,3 +420,13 @@ MSFilter *android_snd_card_create_writer(MSSndCard *card) {
octx->setContext((AAudioContext*)card->data); octx->setContext((AAudioContext*)card->data);
return f; return f;
} }
#ifdef __ANDROID__
JNIEXPORT void JNICALL Java_org_linphone_mediastream_MediastreamerAudioBroadcastReceiver_updateDeviceChangedFlag (JNIEnv * env, jobject obj, jlong ptr, jboolean deviceChanged) {
AAudioOutputContext *octx = (AAudioOutputContext*)ptr;
octx->setDeviceChanged(deviceChanged);
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment