From: Jehan Monnier Date: Fri, 24 May 2013 08:17:29 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/dev_opus' X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=5e44a244beb610354325046afd1c9694275af241;hp=771c7f0e71699d60f2c2c8860a35154a8140c44d Merge remote-tracking branch 'origin/dev_opus' --- diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index db3190bb..d5366e5c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -84,9 +84,11 @@ static bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) { #ifdef VIDEO_ENABLED // If video enabled, check ZRTP encryption in videostream - const LinphoneCallParams *params=linphone_call_get_current_params(call); - if (params->has_video && !call->videostream_encrypted) { - return FALSE; + { + const LinphoneCallParams *params=linphone_call_get_current_params(call); + if (params->has_video && !call->videostream_encrypted) { + return FALSE; + } } #endif @@ -110,9 +112,9 @@ void propagate_encryption_changed(LinphoneCall *call){ #ifdef VIDEO_ENABLED static void linphone_call_videostream_encryption_changed(void *data, bool_t encrypted){ - ms_message("Video stream is %s", encrypted ? "encrypted" : "not encrypted"); - LinphoneCall *call = (LinphoneCall *)data; + + ms_message("Video stream is %s", encrypted ? "encrypted" : "not encrypted"); call->videostream_encrypted=encrypted; propagate_encryption_changed(call); } @@ -135,12 +137,14 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr #ifdef VIDEO_ENABLED // Enable video encryption - const LinphoneCallParams *params=linphone_call_get_current_params(call); - if (params->has_video) { - ms_message("Trying to enable encryption on video stream"); - OrtpZrtpParams params; - params.zid_file=NULL; //unused - video_stream_enable_zrtp(call->videostream,call->audiostream,¶ms); + { + const LinphoneCallParams *params=linphone_call_get_current_params(call); + if (params->has_video) { + OrtpZrtpParams params; + ms_message("Trying to enable encryption on video stream"); + params.zid_file=NULL; //unused + video_stream_enable_zrtp(call->videostream,call->audiostream,¶ms); + } } #endif } @@ -1627,11 +1631,11 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna const char *rtcp_addr=vstream->rtcp_addr[0]!='\0' ? vstream->rtcp_addr : call->resultdesc->addr; call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt); if (used_pt!=-1){ - call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt); VideoStreamDir dir=VideoStreamSendRecv; MSWebCam *cam=lc->video_conf.device; bool_t is_inactive=FALSE; + call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt); call->current_params.has_video=TRUE; video_stream_enable_adaptive_bitrate_control(call->videostream, @@ -1701,9 +1705,6 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){ LinphoneCore *lc=call->core; - call->current_params.audio_codec = NULL; - call->current_params.video_codec = NULL; - LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc); char *cname; bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc); @@ -1712,6 +1713,9 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut SalProtoRtpAvp,SalVideo); #endif + call->current_params.audio_codec = NULL; + call->current_params.video_codec = NULL; + if ((call->audiostream == NULL) && (call->videostream == NULL)) { ms_fatal("start_media_stream() called without prior init !"); return; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 186f6f97..f4e5536e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2840,10 +2840,13 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){ **/ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){ int err=0; +#ifdef VIDEO_ENABLED + bool_t has_video = FALSE; +#endif if (params!=NULL){ linphone_call_set_state(call,LinphoneCallUpdating,"Updating call"); #ifdef VIDEO_ENABLED - bool_t has_video = call->params.has_video; + has_video = call->params.has_video; // Video removing if((call->videostream != NULL) && !params->has_video) { @@ -4679,9 +4682,9 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc) * If not set the core will create its own window. **/ void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){ - lc->preview_window_id=id; #ifdef VIDEO_ENABLED LinphoneCall *call=linphone_core_get_current_call(lc); + lc->preview_window_id=id; if (call!=NULL && call->videostream){ video_stream_set_native_preview_window_id(call->videostream,id); }else if (lc->previewstream){ @@ -4695,8 +4698,8 @@ void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long **/ void linphone_core_show_video(LinphoneCore *lc, bool_t show){ #ifdef VIDEO_ENABLED - ms_error("linphone_core_show_video %d", show); LinphoneCall *call=linphone_core_get_current_call(lc); + ms_error("linphone_core_show_video %d", show); if (call!=NULL && call->videostream){ video_stream_show_video(call->videostream,show); } @@ -4732,9 +4735,11 @@ void linphone_core_set_device_rotation(LinphoneCore *lc, int rotation) { ms_message("%s : rotation=%d\n", __FUNCTION__, rotation); lc->device_rotation = rotation; #ifdef VIDEO_ENABLED - LinphoneCall *call=linphone_core_get_current_call(lc); - if (call!=NULL && call->videostream){ - video_stream_set_device_rotation(call->videostream,rotation); + { + LinphoneCall *call=linphone_core_get_current_call(lc); + if (call!=NULL && call->videostream){ + video_stream_set_device_rotation(call->videostream,rotation); + } } #endif } diff --git a/gtk/chat.c b/gtk/chat.c index 2cba0754..13c14061 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -66,6 +66,7 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) { g_return_if_fail(w!=NULL); gtk_notebook_remove_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),w)); + linphone_chat_room_mark_as_read(cr); linphone_gtk_friend_list_update_chat_picture(); g_object_set_data(G_OBJECT(friendlist),"chatview",NULL); from=g_object_get_data(G_OBJECT(w),"from_message"); @@ -128,6 +129,15 @@ void udpate_tab_chat_header(GtkWidget *chat_view,const LinphoneAddress *uri,Linp gtk_widget_show_all(w); } +static gboolean scroll_to_end(GtkTextView *w){ + GtkTextBuffer *buffer=gtk_text_view_get_buffer(w); + GtkTextIter iter; + gtk_text_buffer_get_end_iter(buffer,&iter); + GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE); + gtk_text_view_scroll_mark_onscreen(w,mark); + return FALSE; +} + void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, gboolean me,LinphoneChatRoom *cr,LinphoneChatMessage *msg, gboolean hist){ GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview")); @@ -198,8 +208,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, } gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert(buffer,&iter,"\n",-1); - GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE); - gtk_text_view_scroll_mark_onscreen(text,mark); + g_idle_add((GSourceFunc)scroll_to_end,text); ms_free(from_str); } @@ -364,7 +373,6 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres colorb.blue = 61952; with_str=linphone_address_as_string_uri_only(with); - linphone_chat_room_mark_as_read(cr); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD_CHAR); gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text),FALSE); @@ -404,8 +412,9 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres } LinphoneChatRoom * linphone_gtk_create_chatroom(const LinphoneAddress *with){ - LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),linphone_address_as_string(with)); - if (!cr) return NULL; + char *tmp=linphone_address_as_string(with); + LinphoneChatRoom *cr=linphone_core_create_chat_room(linphone_gtk_get_core(),tmp); + ms_free(tmp); return cr; } @@ -424,7 +433,6 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri, GtkTextIter end; GtkTextBuffer *text_buffer; - linphone_chat_room_mark_as_read(cr); text_buffer=gtk_text_view_get_buffer(text_view); gtk_text_buffer_get_bounds(text_buffer, &start, &end); gtk_text_buffer_delete (text_buffer, &start, &end); @@ -434,6 +442,8 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri, messages=linphone_chat_room_get_history(cr,NB_MSG_HIST); g_object_set_data(G_OBJECT(chat_view),"from_message",g_strdup(uri_str)); display_history_message(chat_view,messages,uri); + gtk_text_buffer_get_end_iter(text_buffer,&end); + gtk_text_view_scroll_to_iter(text_view,&end,0,FALSE,1.0,0); } ms_free(from_str); ms_free(uri_str); @@ -445,11 +455,6 @@ void linphone_gtk_chat_destroyed(GtkWidget *w){ linphone_chat_room_destroy(cr); } -void linphone_gtk_chat_close(GtkWidget *button){ - GtkWidget *w=gtk_widget_get_toplevel(button); - gtk_widget_destroy(w); -} - void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg ) { @@ -457,7 +462,7 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, GtkWidget *friendlist=linphone_gtk_get_widget ( main_window,"contact_list" ); GtkWidget *w; gboolean send=TRUE; - GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" ); + /*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/ char *from=linphone_address_as_string ( linphone_chat_message_get_from ( msg ) ); w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" ); @@ -481,7 +486,7 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, g_object_set_data ( G_OBJECT ( friendlist ),"from",from ); } -#ifdef HAVE_GTK_OSXs +#ifdef HAVE_GTK_OSX /* Notified when a new message is sent */ linphone_gtk_status_icon_set_blinking ( TRUE ); #else @@ -495,14 +500,9 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, } #endif if ( send ) { - if ( gtk_notebook_get_current_page ( notebook ) !=gtk_notebook_page_num ( notebook,w ) ) { - linphone_gtk_show_friends(); - } else { - linphone_chat_room_mark_as_read ( room ); - } linphone_gtk_push_text ( w,linphone_chat_message_get_from ( msg ), FALSE,room,msg,FALSE ); - } else { - linphone_gtk_show_friends(); } + linphone_gtk_show_friends(); + } diff --git a/gtk/friendlist.c b/gtk/friendlist.c index f7e683f9..12da891f 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -352,6 +352,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){ } else { linphone_gtk_load_chatroom(cr,uri,page); } + linphone_chat_room_mark_as_read(cr); gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,page)); linphone_gtk_friend_list_update_chat_picture(); g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(page,"text_entry")); @@ -556,6 +557,13 @@ static void on_name_column_clicked(GtkTreeModel *model){ static int get_friend_weight(const LinphoneFriend *lf){ int w=0; + LinphoneCore *lc=linphone_gtk_get_core(); + LinphoneChatRoom *cr=linphone_core_get_chat_room(lc,linphone_friend_get_address(lf)); + + if (cr && linphone_chat_room_get_unread_messages_count(cr)>0){ + w+=2000; + } + switch(linphone_friend_get_status(lf)){ case LinphoneStatusOnline: w+=1000; diff --git a/mediastreamer2 b/mediastreamer2 index 3f06cd60..58745e58 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3f06cd60f1864b8c811e0f4e4590991802ce5ea7 +Subproject commit 58745e5866d325c07255bf34225c8b621e87870b