Commit 31f304b9 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix crash when attempting to change the camera for video stream that is not started

parent e428bf42
......@@ -1664,15 +1664,15 @@ 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 ){
&& call->videostream!=NULL && video_stream_started(call->videostream) ){
if (video_stream_get_camera(call->videostream) != linphone_call_get_video_device(call)) {
ms_message("Swithching video cam from [%s] to %s on call [%p]" ,ms_web_cam_get_name(video_stream_get_camera(call->videostream))
,ms_web_cam_get_name(linphone_call_get_video_device(call))
,call);
video_stream_change_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));
}
}
#endif
}
......
......@@ -273,7 +273,7 @@ LinphoneCoreManager* linphone_core_manager_init(const char* rc_file) {
if (cam == NULL) {
cam=ms_web_cam_new(&mire_desc);
ms_web_cam_manager_add_cam(ms_web_cam_manager_get(),cam);
ms_web_cam_manager_add_cam(ms_web_cam_manager_get(), cam);
}
}
#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