]> sjero.net Git - linphone/blobdiff - coreapi/callbacks.c
Allow update of SRTP crypto keys without restarting the media streams.
[linphone] / coreapi / callbacks.c
index 134c336abe3cc946715746477b40c9b35bbb7e93..f9399553f32512ce76421577977fb2f69f781928 100644 (file)
@@ -104,31 +104,40 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
                /* we already started media: check if we really need to restart it*/
                if (oldmd){
                        int md_changed = media_parameters_changed(call, oldmd, new_md);
-                       if ((md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) && !call->playing_ringbacktone) {
-                               /*as nothing has changed, keep the oldmd */
-                               call->resultdesc=oldmd;
-                               sal_media_description_unref(new_md);
-                               if (call->all_muted){
-                                       ms_message("Early media finished, unmuting inputs...");
-                                       /*we were in early media, now we want to enable real media */
-                                       linphone_call_enable_camera (call,linphone_call_camera_enabled (call));
-                                       if (call->audiostream)
-                                               linphone_core_mute_mic (lc, linphone_core_is_mic_muted(lc));
+                       if ((md_changed & SAL_MEDIA_DESCRIPTION_CODEC_CHANGED) || call->playing_ringbacktone) {
+                               ms_message("Media descriptions are different, need to restart the streams.");
+                       } else {
+                               if (md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) {
+                                       /*as nothing has changed, keep the oldmd */
+                                       call->resultdesc=oldmd;
+                                       sal_media_description_unref(new_md);
+                                       if (call->all_muted){
+                                               ms_message("Early media finished, unmuting inputs...");
+                                               /*we were in early media, now we want to enable real media */
+                                               linphone_call_enable_camera (call,linphone_call_camera_enabled (call));
+                                               if (call->audiostream)
+                                                       linphone_core_mute_mic (lc, linphone_core_is_mic_muted(lc));
 #ifdef VIDEO_ENABLED
-                                       if (call->videostream && call->camera_active)
-                                               video_stream_change_camera(call->videostream,lc->video_conf.device );
+                                               if (call->videostream && call->camera_active)
+                                                       video_stream_change_camera(call->videostream,lc->video_conf.device );
 #endif
+                                       }
+                                       ms_message("No need to restart streams, SDP is unchanged.");
+                                       return;
+                               }
+                               else {
+                                       if (md_changed & SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED) {
+                                               ms_message("Network parameters have changed, update them.");
+                                               linphone_core_update_streams_destinations(lc, call, oldmd, new_md);
+                                       }
+                                       if (md_changed & SAL_MEDIA_DESCRIPTION_CRYPTO_CHANGED) {
+                                               ms_message("Crypto parameters have changed, update them.");
+                                               linphone_call_update_crypto_parameters(call, oldmd, new_md);
+                                       }
+                                       call->resultdesc = oldmd;
+                                       sal_media_description_unref(new_md);
+                                       return;
                                }
-                               ms_message("No need to restart streams, SDP is unchanged.");
-                               return;
-                       } else if ((md_changed == SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED) && !call->playing_ringbacktone) {
-                               call->resultdesc = oldmd;
-                               ms_message("Network parameters have changed, update them.");
-                               linphone_core_update_streams_destinations(lc, call, oldmd, new_md);
-                               sal_media_description_unref(new_md);
-                               return;
-                       }else{
-                               ms_message("Media descriptions are different, need to restart the streams.");
                        }
                }
                linphone_call_stop_media_streams (call);