ekiga r6932 - in trunk: . lib/engine/videooutput/common src/devices src/endpoints



Author: mschneid
Date: Thu Sep 11 18:34:22 2008
New Revision: 6932
URL: http://svn.gnome.org/viewvc/ekiga?rev=6932&view=rev

Log:
Finally fixed reinvite video completely. Reference counting
is also needed in the stub video input device.
Improved STUN timers.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/videooutput/common/videooutput-manager-common.cpp
   trunk/src/devices/videoinput.cpp
   trunk/src/devices/videoinput.h
   trunk/src/devices/videooutput.cpp
   trunk/src/endpoints/manager.cpp

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 18:34:22 2008
@@ -155,21 +155,28 @@
    * display what we can actually display.
    */
   if (devices_nbr <= 1) {
-    if (!local)
-      local_display_info.mode = Ekiga::VO_MODE_REMOTE;
-    else 
+    if (local) {
       local_display_info.mode = Ekiga::VO_MODE_LOCAL;
-  }
+      remote_frame_received = false;
+    }
+    else {
+      local_display_info.mode = Ekiga::VO_MODE_REMOTE;
+      local_frame_received = false;
+    }
+
+    current_frame.both_streams_active = false;;
+  } 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_LOCAL;
   
-  if (!local_frame_received && remote_frame_received)
-      local_display_info.mode = Ekiga::VO_MODE_REMOTE;
+    if (!local_frame_received && remote_frame_received)
+        local_display_info.mode = Ekiga::VO_MODE_REMOTE;
 
+    current_frame.both_streams_active = local_frame_received & remote_frame_received;
+  }
   current_frame.mode = local_display_info.mode;
   current_frame.zoom = local_display_info.zoom; 
-  current_frame.both_streams_active = local_frame_received & remote_frame_received;
 
   if (local) {
 

Modified: trunk/src/devices/videoinput.cpp
==============================================================================
--- trunk/src/devices/videoinput.cpp	(original)
+++ trunk/src/devices/videoinput.cpp	Thu Sep 11 18:34:22 2008
@@ -66,11 +66,13 @@
 
 PCREATE_PLUGIN(EKIGA, PVideoInputDevice, &PVideoInputDevice_EKIGA_descriptor);
 
+int PVideoInputDevice_EKIGA::devices_nbr = 0;
 
 PVideoInputDevice_EKIGA::PVideoInputDevice_EKIGA (Ekiga::ServiceCore & _core)
 : core (_core), videoinput_core (*(dynamic_cast<Ekiga::VideoInputCore *> (_core.get ("videoinput-core"))))
 {
   opened = false;
+  is_active = false;
 }
 
 
@@ -84,8 +86,14 @@
 			       bool start_immediate)
 {
   if (start_immediate) {
-    videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
-    videoinput_core.start_stream();
+    if (!is_active) {
+      if (devices_nbr == 0) {
+        videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
+        videoinput_core.start_stream();
+      }
+      is_active = true;
+      devices_nbr++;
+    }
   }
   opened = true;
 
@@ -103,7 +111,12 @@
 bool
 PVideoInputDevice_EKIGA::Close ()
 {
-  videoinput_core.stop_stream();
+  if (is_active) {
+    devices_nbr--;
+    if (devices_nbr==0)
+      videoinput_core.stop_stream();
+    is_active = false;
+  }
   opened = false;
 
   return true;
@@ -113,8 +126,14 @@
 bool
 PVideoInputDevice_EKIGA::Start ()
 {
-  videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
-  videoinput_core.start_stream();
+  if (!is_active) {
+    if (devices_nbr == 0) {
+      videoinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
+      videoinput_core.start_stream();
+    }
+    is_active = true;
+    devices_nbr++;
+  }
 
   return true;
 }

Modified: trunk/src/devices/videoinput.h
==============================================================================
--- trunk/src/devices/videoinput.h	(original)
+++ trunk/src/devices/videoinput.h	Thu Sep 11 18:34:22 2008
@@ -176,6 +176,9 @@
 
   virtual PStringArray GetDeviceNames() const;
 
+  static int devices_nbr;
+  bool is_active;
+  
 protected:
   Ekiga::ServiceCore & core;
   Ekiga::VideoInputCore & videoinput_core;

Modified: trunk/src/devices/videooutput.cpp
==============================================================================
--- trunk/src/devices/videooutput.cpp	(original)
+++ trunk/src/devices/videooutput.cpp	Thu Sep 11 18:34:22 2008
@@ -94,7 +94,7 @@
   PWaitAndSignal m(videoDisplay_mutex);
 
   if (is_active)
-    devices_nbr = PMAX (0, devices_nbr-1);
+    devices_nbr--;
   if (devices_nbr == 0) {
     videooutput_core.stop();
   }
@@ -153,7 +153,7 @@
   /* Device is now open */
   if (!is_active) {
     is_active = TRUE;
-    devices_nbr = PMIN (2, devices_nbr+1);
+    devices_nbr++;
   }
   videooutput_core.set_frame_data((const char*) data, width, height, (device_id == LOCAL), devices_nbr);
 

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Thu Sep 11 18:34:22 2008
@@ -166,7 +166,7 @@
   // Ready
   new StunDetector (stun_server, *this, queue);
 
-  patience = 3;
+  patience = 20;
   runtime.run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult), 1);
 }
 
@@ -719,25 +719,10 @@
 
   } else {
 
-    if (patience == 3) {
-
-      patience--;
-      runtime.run_in_main (sigc::mem_fun (this,
-					  &CallManager::HandleSTUNResult),
-			   3);
-    } else if (patience == 2) {
-
       patience--;
       runtime.run_in_main (sigc::mem_fun (this,
 					  &CallManager::HandleSTUNResult),
-			   21);
-    } else if (patience == 1) {
-
-      patience--;
-      runtime.run_in_main (sigc::mem_fun (this,
-					  &CallManager::HandleSTUNResult),
-			   30);
-    }
+			   1);
   }
 }
 



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