ekiga r6929 - in trunk: . lib/engine/videooutput/common



Author: mschneid
Date: Thu Sep 11 16:35:48 2008
New Revision: 6929
URL: http://svn.gnome.org/viewvc/ekiga?rev=6929&view=rev

Log:
Fix ugly crash with video on reinvite
(XV tried to create a window with 0x


Modified:
   trunk/ChangeLog
   trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp
   trunk/lib/engine/videooutput/common/videooutput-manager-common.h

Modified: trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp
==============================================================================
--- trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp	(original)
+++ trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp	Thu Sep 11 16:35:48 2008
@@ -96,8 +96,8 @@
 
     if (initialised_thread) {
       var_mutex.Wait ();
-        do_sync = first_frame_received;
-        if (first_frame_received)
+        do_sync = local_frame_received | remote_frame_received;
+        if (do_sync)
           sync_required = redraw();
       var_mutex.Signal ();
       if (do_sync)
@@ -124,7 +124,7 @@
 					   unsigned width,
 					   unsigned height,
 					   bool local,
-					   int devices_nbr)
+					   int /*devices_nbr*/)
 { 
   Ekiga::DisplayInfo local_display_info;
 
@@ -132,30 +132,40 @@
 
   var_mutex.Wait();
 
+  if (local) {
+
+    /* memcpy the frame */
+    lframeStore.SetSize (width * height * 3);
+    current_frame.local_width = width;
+    current_frame.local_height= height;
+    memcpy (lframeStore.GetPointer(), data, (width * height * 3) >> 1);
+    local_frame_received = true;
+  }
+  else {
+
+    /* memcpy the frame */
+    rframeStore.SetSize (width * height * 3);
+    current_frame.remote_width = width;
+    current_frame.remote_height= height;
+    memcpy (rframeStore.GetPointer(), data, (width * height * 3) >> 1);
+    remote_frame_received = true;
+  }
+
   /* If there is only one device open, ignore the setting, and 
    * display what we can actually display.
    */
-  if (devices_nbr <= 1) {
-
-    if (!local)
-      local_display_info.mode = Ekiga::VO_MODE_REMOTE;
-    else 
+  if (local_frame_received && !remote_frame_received)
       local_display_info.mode = Ekiga::VO_MODE_LOCAL;
-  }
+  
+  if (!local_frame_received && remote_frame_received)
+      local_display_info.mode = Ekiga::VO_MODE_REMOTE;
 
   current_frame.mode = local_display_info.mode;
   current_frame.zoom = local_display_info.zoom; 
-  current_frame.both_streams_active = (devices_nbr == 2);
-  first_frame_received = true;
+  current_frame.both_streams_active = local_frame_received & remote_frame_received;
 
   if (local) {
 
-    /* memcpy the frame */
-    lframeStore.SetSize (width * height * 3);
-    current_frame.local_width = width;
-    current_frame.local_height= height;
-    memcpy (lframeStore.GetPointer(), data, (width * height * 3) >> 1);
-
     if (update_required.local) {
       PTRACE(3, "GMVideoOutputManager\tSkipped earlier local frame");
     }
@@ -163,12 +173,6 @@
   }
   else {
 
-    /* memcpy the frame */
-    rframeStore.SetSize (width * height * 3);
-    current_frame.remote_width = width;
-    current_frame.remote_height= height;
-    memcpy (rframeStore.GetPointer(), data, (width * height * 3) >> 1);
-
     if (update_required.remote) {
       PTRACE(3, "GMVideoOutputManager\tSkipped earlier remote frame");
     }
@@ -215,7 +219,8 @@
 
   /* Initialisation */
   video_disabled = false;
-  first_frame_received = false;
+  local_frame_received = false;
+  remote_frame_received = false;
   update_required.local = false;
   update_required.remote = false;
 

Modified: trunk/lib/engine/videooutput/common/videooutput-manager-common.h
==============================================================================
--- trunk/lib/engine/videooutput/common/videooutput-manager-common.h	(original)
+++ trunk/lib/engine/videooutput/common/videooutput-manager-common.h	Thu Sep 11 16:35:48 2008
@@ -237,7 +237,8 @@
     FrameInfo last_frame;
     FrameInfo current_frame;
     
-    bool first_frame_received;
+    bool local_frame_received;
+    bool remote_frame_received;
     bool video_disabled;
 
     UpdateRequired update_required;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]