ekiga r7137 - in trunk: . lib/gui



Author: mschneid
Date: Wed Oct  1 16:57:45 2008
New Revision: 7137
URL: http://svn.gnome.org/viewvc/ekiga?rev=7137&view=rev

Log:
Fix flickering issues on XV due to the X Server's strange
bookkeeping of used ports.


Modified:
   trunk/ChangeLog
   trunk/lib/gui/xvwindow.cpp
   trunk/lib/gui/xvwindow.h

Modified: trunk/lib/gui/xvwindow.cpp
==============================================================================
--- trunk/lib/gui/xvwindow.cpp	(original)
+++ trunk/lib/gui/xvwindow.cpp	Wed Oct  1 16:57:45 2008
@@ -53,6 +53,8 @@
 }
 #endif
 
+std::set <XvPortID> XVWindow::grabbedPorts;
+
 XVWindow::XVWindow()
 {
   // initialize class variables
@@ -100,6 +102,7 @@
   if (_XVPort) {
 
     XvUngrabPort (_display, _XVPort, CurrentTime);
+    grabbedPorts.erase(_XVPort);
     _XVPort = 0;
   }
 
@@ -400,6 +403,12 @@
 
       for (candidateXVPort = xvainfo [i].base_id ; candidateXVPort < (xvainfo [i].base_id + xvainfo [i].num_ports) ; ++candidateXVPort) {
 
+        if (grabbedPorts.find(candidateXVPort) != grabbedPorts.end()) {
+          PTRACE(4, "XVideo\tPort " << candidateXVPort << " already grabbed by ourselves");
+          ++busyPorts;
+          continue;
+        }
+
         if (PTrace::CanTrace (4)) 
           DumpCapabilities (candidateXVPort);
 
@@ -425,7 +434,8 @@
 
             PTRACE(4, "XVideo\tGrabbed Port: " << candidateXVPort);
             XvFreeAdaptorInfo (xvainfo);
-
+            grabbedPorts.insert(candidateXVPort);
+            
             return candidateXVPort;
           } 
           else {

Modified: trunk/lib/gui/xvwindow.h
==============================================================================
--- trunk/lib/gui/xvwindow.h	(original)
+++ trunk/lib/gui/xvwindow.h	Wed Oct  1 16:57:45 2008
@@ -39,6 +39,7 @@
 #define XVWINDOW_H
 
 #include <stdint.h>
+#include <set>
 #include "config.h"
 
 #include <X11/Xlib.h>
@@ -143,6 +144,8 @@
 #ifdef HAVE_SHM  
   virtual void ShmAttach(int imageWidth, int imageHeight);
 #endif
+
+  static std::set <XvPortID> grabbedPorts;
 };
 
 #endif //XVWINDOW_H



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