[ekiga] Applied patch making the video input core retain a reference on the video output core



commit 26403938e992b2df7f8dc8569a2d94de1640e607
Author: Julien Puydt <jpuydt gnome org>
Date:   Wed Oct 7 07:30:53 2009 +0200

    Applied patch making the video input core retain a reference on the video output core
    
    Thanks to Michael Rickmann.
    
    Notice that we're then using that pointer through threads which is ok,
    and not modifying it afterwards, so we avoid the threading pitfalls of
    boost smart pointers.

 lib/engine/engine.cpp                     |    2 +-
 lib/engine/videoinput/videoinput-core.cpp |   10 +++++-----
 lib/engine/videoinput/videoinput-core.h   |    6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 46a4e4e..0777a46 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -122,7 +122,7 @@ engine_init (int argc,
   boost::shared_ptr<Ekiga::CallCore> call_core (new Ekiga::CallCore);
   boost::shared_ptr<Ekiga::ChatCore> chat_core (new Ekiga::ChatCore);
   boost::shared_ptr<Ekiga::VideoOutputCore> videooutput_core (new Ekiga::VideoOutputCore);
-  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore(*videooutput_core));
+  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore(videooutput_core));
   boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core (new Ekiga::AudioOutputCore);
   boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core (new Ekiga::AudioInputCore(*audiooutput_core));
   boost::shared_ptr<Ekiga::HalCore> hal_core (new Ekiga::HalCore);
diff --git a/lib/engine/videoinput/videoinput-core.cpp b/lib/engine/videoinput/videoinput-core.cpp
index cea3675..090b19b 100644
--- a/lib/engine/videoinput/videoinput-core.cpp
+++ b/lib/engine/videoinput/videoinput-core.cpp
@@ -44,7 +44,7 @@
 
 using namespace Ekiga;
 
-VideoInputCore::VideoPreviewManager::VideoPreviewManager (VideoInputCore& _videoinput_core, VideoOutputCore& _videooutput_core)
+VideoInputCore::VideoPreviewManager::VideoPreviewManager (VideoInputCore& _videoinput_core, boost::shared_ptr<VideoOutputCore> _videooutput_core)
 : PThread (1000, NoAutoDeleteThread, HighestPriority, "VideoPreviewManager"),
     videoinput_core (_videoinput_core),
   videooutput_core (_videooutput_core)
@@ -77,7 +77,7 @@ void VideoInputCore::VideoPreviewManager::start (unsigned _width, unsigned _heig
   end_thread = false;
   frame = (char*) malloc (unsigned (width * height * 3 / 2));
 
-  videooutput_core.start();
+  videooutput_core->start();
   pause_thread = false;
   run_thread.Signal();
 }
@@ -92,7 +92,7 @@ void VideoInputCore::VideoPreviewManager::stop ()
     free (frame);
     frame = NULL;
   }  
-  videooutput_core.stop();
+  videooutput_core->stop();
 }
 
 void VideoInputCore::VideoPreviewManager::Main ()
@@ -108,7 +108,7 @@ void VideoInputCore::VideoPreviewManager::Main ()
     while (!pause_thread) {
       if (frame) {
         videoinput_core.get_frame_data(frame);
-        videooutput_core.set_frame_data(frame, width, height, true, 1);
+        videooutput_core->set_frame_data(frame, width, height, true, 1);
       }
       // We have to sleep some time outside the mutex lock
       // to give other threads time to get the mutex
@@ -119,7 +119,7 @@ void VideoInputCore::VideoPreviewManager::Main ()
   }
 }
 
-VideoInputCore::VideoInputCore (VideoOutputCore& _videooutput_core)
+VideoInputCore::VideoInputCore (boost::shared_ptr<VideoOutputCore> _videooutput_core)
 :  preview_manager(*this, _videooutput_core)
 {
   PWaitAndSignal m_var(core_mutex);
diff --git a/lib/engine/videoinput/videoinput-core.h b/lib/engine/videoinput/videoinput-core.h
index 33cd200..02f9972 100644
--- a/lib/engine/videoinput/videoinput-core.h
+++ b/lib/engine/videoinput/videoinput-core.h
@@ -105,7 +105,7 @@ namespace Ekiga
        * @param _runtime reference to Ekiga runtime.
        * @param _videooutput_core reference ot the video output core.
        */
-      VideoInputCore (VideoOutputCore& _videooutput_core);
+      VideoInputCore (boost::shared_ptr<VideoOutputCore> _videooutput_core);
 
       /** The destructor
        */
@@ -327,7 +327,7 @@ private:
         * @param _videoinput_core reference to the video input core.
         * @param _videooutput_core reference to the video output core.
         */
-        VideoPreviewManager(VideoInputCore & _videoinput_core, VideoOutputCore & _videooutput_core);
+        VideoPreviewManager(VideoInputCore & _videoinput_core, boost::shared_ptr<VideoOutputCore> _videooutput_core);
 
         /** The destructor
         */
@@ -358,7 +358,7 @@ private:
         PSyncPoint run_thread;
 
         VideoInputCore  & videoinput_core;
-        VideoOutputCore & videooutput_core;
+        boost::shared_ptr<VideoOutputCore> videooutput_core;
         unsigned width;
         unsigned height;
       };



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