[ekiga/gnome-2-26] Fixed possible threading issues in the DX video output code



commit 0e0ad7480581a5158cc5444658ec562632d80dab
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Tue Apr 21 18:32:35 2009 +0200

    Fixed possible threading issues in the DX video output code
    
    don't use make_slot in threads
    (notice: those change haven't been tested...)
---
 .../dx-videooutput/videooutput-manager-dx.cpp      |   52 ++++++++++++++++----
 .../dx-videooutput/videooutput-manager-dx.h        |   16 ++++++
 2 files changed, 58 insertions(+), 10 deletions(-)

diff --git a/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp b/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp
index e997aa3..a29cd40 100644
--- a/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp
+++ b/lib/engine/components/dx-videooutput/videooutput-manager-dx.cpp
@@ -76,21 +76,19 @@ GMVideoOutputManager_dx::setup_frame_display ()
     
   get_display_info(local_display_info);
 
-//  Ekiga::Runtime::run_in_main (force_redraw.make_slot ()); //FIXME: check
-
   switch (current_frame.mode) {
   case Ekiga::VO_MODE_LOCAL:
-    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoOutputManager_dx::size_changed_in_main), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
     break;
   case Ekiga::VO_MODE_REMOTE:
   case Ekiga::VO_MODE_PIP:
-    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoOutputManager_dx::size_changed_in_main), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
     break;
   case Ekiga::VO_MODE_FULLSCREEN:
-    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoOutputManager_dx::size_changed_in_main), 176, 144));
     break;
   case Ekiga::VO_MODE_PIP_WINDOW:
-    Ekiga::Runtime::run_in_main (sigc::bind (size_changed.make_slot (), 176, 144));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoOutputManager_dx::size_changed_in_main), 176, 144));
     break;
   case Ekiga::VO_MODE_UNSET:
   default:
@@ -199,18 +197,18 @@ GMVideoOutputManager_dx::setup_frame_display ()
   if (video_disabled) {
     delete dxWindow;
     dxWindow = NULL;
-    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoDisplay_DX::device_error_in_main), Ekiga::VO_ERROR));
   }
   else {
     current_frame.accel = Ekiga::VO_ACCEL_ALL; 
-    Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoDisplay_DX::device_opened_in_main), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
   }
 }
 
 void
 GMVideoOutputManager_dx::close_frame_display ()
 {
-  Ekiga::Runtime::run_in_main (device_closed.make_slot ());
+  Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &GMVideoOutputManager_dx::device_closed_in_main));
 
   if (dxWindow) {
 
@@ -242,7 +240,7 @@ GMVideoOutputManager_dx::display_pip_frames (const char *local_frame,
     dxWindow->ProcessEvents(); 
 
   if (current_frame.mode == Ekiga::VO_MODE_FULLSCREEN && dxWindow && !dxWindow->IsFullScreen ())
-    Ekiga::Runtime::run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), Ekiga::VO_FS_OFF));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoOutputManager_dx::fullscreen_mode_changed_in_main), Ekiga::VO_FS_OFF));
 
   if (dxWindow) {
     if (update_required.remote || (!update_required.remote && !update_required.local)) {
@@ -261,3 +259,37 @@ GMVideoOutputManager_dx::sync (UpdateRequired sync_required)
   if (dxWindow)
     dxWindow->Sync(); 
 }
+
+void
+size_changed_in_main (unsigned width,
+		      unsigned height)
+{
+  size_changed.emit (width, height);
+}
+
+void
+device_opened_in_main (Ekiga::VideoOutputAccel accel,
+		       Ekiga::VideoOutputMode mode,
+		       unsigned zoom,
+		       bool both)
+{
+  device_opened.emit (accel, mode, zoom, both);
+}
+
+void
+device_closed_in_main ()
+{
+  device_closed.emit ();
+}
+
+void
+device_error_in_main (Ekiga::VideoOutputErrorCodes code)
+{
+  device_error.emit (code);
+}
+
+void
+fullscreen_mode_changed_in_main (Ekiga::VideoOutputFSToggle val)
+{
+  fullscreen_mode_changed.emit (val);
+}
diff --git a/lib/engine/components/dx-videooutput/videooutput-manager-dx.h b/lib/engine/components/dx-videooutput/videooutput-manager-dx.h
index 3c77263..40e7d90 100644
--- a/lib/engine/components/dx-videooutput/videooutput-manager-dx.h
+++ b/lib/engine/components/dx-videooutput/videooutput-manager-dx.h
@@ -79,6 +79,22 @@
     virtual void sync(UpdateRequired sync_required);
 
     DXWindow *dxWindow;
+
+  private:
+
+  void size_changed_in_main (unsigned width,
+			     unsigned height);
+
+  void device_opened_in_main (Ekiga::VideoOutputAccel accel,
+			      Ekiga::VideoOutputMode mode,
+			      unsigned zoom,
+			      bool both);
+
+  void device_closed_in_main ();
+
+  void device_error_in_main (Ekiga::VideoOutputErrorCodes code);
+
+  void fullscreen_mode_changed_in_main (Ekiga::VideoOutputFSToggle val);
   };
 
 /**



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