]> sjero.net Git - linphone/commitdiff
Merge remote-tracking branch 'origin/dev_opus'
authorJehan Monnier <jehan.monnier@linphone.org>
Fri, 24 May 2013 08:17:29 +0000 (10:17 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Fri, 24 May 2013 08:17:29 +0000 (10:17 +0200)
coreapi/linphonecall.c
coreapi/linphonecore.c
gtk/chat.c
gtk/friendlist.c
mediastreamer2

index db3190bbb3e851709690144472689ea3cc3e6ad5..d5366e5c66a3da90a322392b1adaa029a39626b9 100644 (file)
@@ -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,&params);
+       {
+               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,&params);
+               }
        }
 #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;
index 186f6f976cc3de3dea3ca294919c3b65fe91da54..f4e5536ede8dd391335f2857492f411fcef5fb52 100644 (file)
@@ -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
 }
index 2cba0754fe48772caa9932cfb9edaf6db70ccaa9..13c1406156ba645c95f44c1a91cbc82a09115d0b 100644 (file)
@@ -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();
+       
 }
index f7e683f959341fdd4f9bced7f60c4d553308b892..12da891f41410396e3a9d4cb813386a372a2c8a1 100644 (file)
@@ -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;
index 3f06cd60f1864b8c811e0f4e4590991802ce5ea7..58745e5866d325c07255bf34225c8b621e87870b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 3f06cd60f1864b8c811e0f4e4590991802ce5ea7
+Subproject commit 58745e5866d325c07255bf34225c8b621e87870b