diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 1e14854a9..41b399e08 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -158,12 +158,12 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia 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)); + call->all_muted = FALSE; if (call->audiostream) linphone_core_enable_mic(lc, linphone_core_mic_enabled(lc)); #ifdef VIDEO_ENABLED if (call->videostream && call->camera_enabled) - video_stream_change_camera(call->videostream,linphone_call_get_video_device(call)); + linphone_call_enable_camera(call, linphone_call_camera_enabled(call)); #endif } /*FIXME ZRTP, might be restarted in any cases ? */ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index acad05698..39089fdbe 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2054,15 +2054,23 @@ LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call){ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){ #ifdef VIDEO_ENABLED call->camera_enabled=enable; - if ((call->state==LinphoneCallStreamsRunning || call->state==LinphoneCallOutgoingEarlyMedia || call->state==LinphoneCallIncomingEarlyMedia) - && call->videostream!=NULL && video_stream_started(call->videostream) ){ - if (video_stream_get_camera(call->videostream) != linphone_call_get_video_device(call)) { - const char *cur_cam, *new_cam; - cur_cam = video_stream_get_camera(call->videostream) ? ms_web_cam_get_name(video_stream_get_camera(call->videostream)) : "NULL"; - new_cam = linphone_call_get_video_device(call) ? ms_web_cam_get_name(linphone_call_get_video_device(call)) : "NULL"; - ms_message("Switching video cam from [%s] to [%s] on call [%p]" , cur_cam, new_cam, call); - video_stream_change_camera(call->videostream, linphone_call_get_video_device(call)); - } + switch(call->state) { + case LinphoneCallStreamsRunning: + case LinphoneCallOutgoingEarlyMedia: + case LinphoneCallIncomingEarlyMedia: + case LinphoneCallConnected: + if(call->videostream!=NULL + && video_stream_started(call->videostream) + && video_stream_get_camera(call->videostream) != linphone_call_get_video_device(call)) { + const char *cur_cam, *new_cam; + cur_cam = video_stream_get_camera(call->videostream) ? ms_web_cam_get_name(video_stream_get_camera(call->videostream)) : "NULL"; + new_cam = linphone_call_get_video_device(call) ? ms_web_cam_get_name(linphone_call_get_video_device(call)) : "NULL"; + ms_message("Switching video cam from [%s] to [%s] on call [%p]" , cur_cam, new_cam, call); + video_stream_change_camera(call->videostream, linphone_call_get_video_device(call)); + } + break; + + default: break; } #endif }