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

This commit is contained in:
Simon Morlat 2015-03-24 21:29:46 +01:00
parent e428bf42b8
commit 31f304b9d0
2 changed files with 7 additions and 7 deletions

View file

@ -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
}

View file

@ -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