From d777e00ac9b91c1d05d438bd466113b0366500fc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Dec 2013 10:38:59 +0100 Subject: [PATCH] change behavior of LinphoneCall::camera_enabled It is now an application preference, the core never modifies it. It represents whether the camera is allowed to be sent (in case of video request). --- coreapi/callbacks.c | 2 +- coreapi/conference.c | 2 +- coreapi/linphonecall.c | 13 ++++++------- coreapi/linphonecore.c | 6 ++---- coreapi/private.h | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index e73a60fa9..a9c364c52 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -98,7 +98,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia if (call->audiostream) linphone_core_enable_mic(lc, linphone_core_mic_enabled(lc)); #ifdef VIDEO_ENABLED - if (call->videostream && call->camera_active) + if (call->videostream && call->camera_enabled) video_stream_change_camera(call->videostream,lc->video_conf.device ); #endif } diff --git a/coreapi/conference.c b/coreapi/conference.c index 53d3edf40..2e5c2ccde 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -99,7 +99,7 @@ void linphone_call_add_to_conf(LinphoneCall *call, bool_t muted){ LinphoneConference *conf=&lc->conf_ctx; MSAudioEndpoint *ep; call->params.has_video = FALSE; - call->camera_active = FALSE; + call->camera_enabled = FALSE; ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE); ms_audio_conference_add_member(conf->conf,ep); ms_audio_conference_mute_member(conf->conf,ep,muted); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 19caa2059..fe0df1221 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -438,6 +438,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, call->media_start_time=0; call->log=linphone_call_log_new(call, from, to); call->owns_call_log=TRUE; + call->camera_enabled=TRUE; linphone_core_get_audio_port_range(call->core, &min_port, &max_port); if (min_port == max_port) { @@ -544,7 +545,6 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr } } #endif //BUILD_UPNP - call->camera_active=params->has_video; discover_mtu(lc,linphone_address_get_domain (to)); if (params->referer){ @@ -641,7 +641,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro default: break; } - call->camera_active=call->params.has_video; discover_mtu(lc,linphone_address_get_domain(from)); return call; @@ -1084,12 +1083,12 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){ if (call->videostream!=NULL && call->videostream->ms.ticker!=NULL){ LinphoneCore *lc=call->core; MSWebCam *nowebcam=get_nowebcam_device(); - if (call->camera_active!=enable && lc->video_conf.device!=nowebcam){ + if (call->camera_enabled!=enable && lc->video_conf.device!=nowebcam){ video_stream_change_camera(call->videostream, enable ? lc->video_conf.device : nowebcam); } } - call->camera_active=enable; + call->camera_enabled=enable; #endif } @@ -1120,10 +1119,10 @@ int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){ } /** - * Returns TRUE if camera pictures are sent to the remote party. + * Returns TRUE if camera pictures are allowed to be sent to the remote party. **/ bool_t linphone_call_camera_enabled (const LinphoneCall *call){ - return call->camera_active; + return call->camera_enabled; } /** @@ -1849,7 +1848,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna /*either inactive or incompatible with local capabilities*/ is_inactive=TRUE; } - if (call->camera_active==FALSE || all_inputs_muted){ + if (call->camera_enabled==FALSE || all_inputs_muted){ cam=get_nowebcam_device(); } if (!is_inactive){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 45c740a29..104925d51 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2964,7 +2964,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){ const char *subject; - call->camera_active=call->params.has_video; + if (call->ice_session != NULL) { linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); } @@ -3065,7 +3065,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho #ifdef VIDEO_ENABLED if ((call->videostream != NULL) && (call->state == LinphoneCallStreamsRunning)) { video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc)); - if (call->camera_active && call->videostream->cam!=lc->video_conf.device){ + if (call->camera_enabled && call->videostream->cam!=lc->video_conf.device){ video_stream_change_camera(call->videostream,lc->video_conf.device); }else video_stream_update_video_params(call->videostream); } @@ -3177,7 +3177,6 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const call->params.has_video = FALSE; } call->params.has_video &= linphone_core_media_description_contains_video_stream(remote_desc); - call->camera_active=call->params.has_video; linphone_call_make_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, remote_desc); @@ -3298,7 +3297,6 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, // There might not be a md if the INVITE was lacking an SDP // In this case we use the parameters as is. if (md) call->params.has_video &= linphone_core_media_description_contains_video_stream(md); - call->camera_active=call->params.has_video; linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); } diff --git a/coreapi/private.h b/coreapi/private.h index 69ee5b61e..5225b6a3c 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -205,7 +205,7 @@ struct _LinphoneCall bool_t refer_pending; bool_t media_pending; bool_t audio_muted; - bool_t camera_active; + bool_t camera_enabled; bool_t all_muted; /*this flag is set during early medias*/ bool_t playing_ringbacktone;