Index: /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp (revision 9847)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp (revision 9861)
@@ -42,5 +42,4 @@
 private:
 
-    //typedef boost::shared_ptr<AVFrame> FramePtr;
     typedef osg::ref_ptr<osg::AudioSink> SinkPtr;
     typedef std::vector<uint8_t> Buffer;
Index: /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp (revision 9860)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp (revision 9861)
@@ -33,4 +33,6 @@
 FFmpegDecoderVideo::~FFmpegDecoderVideo()
 {
+    osg::notify(osg::NOTICE)<<"Destructing FFmpegDecoderVideo..."<<std::endl;
+
     if (isRunning())
     {
@@ -46,4 +48,6 @@
     }
 #endif
+
+    osg::notify(osg::NOTICE)<<"Destructed FFmpegDecoderVideo"<<std::endl;
 }
 
@@ -261,6 +265,4 @@
     AVPicture * const dst = (AVPicture *) m_frame_rgba.get();
 
-    osg::Timer_t startTick = osg::Timer::instance()->tick();
-
     // Assign appropriate parts of the buffer to image planes in m_frame_rgba
     avpicture_fill((AVPicture *) (m_frame_rgba).get(), &(m_buffer_rgba[m_writeBuffer])[0], PIX_FMT_RGB32, width(), height());
@@ -273,12 +275,4 @@
         convert(dst, PIX_FMT_RGB32, src, m_context->pix_fmt, width(), height());
 
-
-    // Flip and swap buffer
-    // swapBuffers();
-
-
-    osg::Timer_t endTick = osg::Timer::instance()->tick();
-    osg::notify(osg::NOTICE)<<" time of swapBuffers = "<<osg::Timer::instance()->delta_m(startTick,endTick)<<"ms"<<std::endl;
-
     // Wait 'delay' seconds before publishing the picture.
     int i_delay = static_cast<int>(delay * 1000000 + 0.5);
@@ -300,12 +294,4 @@
 
     m_publish_func(* this, m_user_data);
-}
-
-
-
-void FFmpegDecoderVideo::swapBuffers()
-{
-    for (int h = 0; h < height(); ++h)
-        memcpy(&(m_buffer_rgba[1-m_writeBuffer])[(height() - h - 1) * width() * 4], &(m_buffer_rgba[m_writeBuffer])[h * width() * 4], width() * 4);
 }
 
Index: /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp (revision 9860)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp (revision 9861)
@@ -40,7 +40,15 @@
 FFmpegImageStream::~FFmpegImageStream()
 {
+    osg::notify(osg::NOTICE)<<"Destructing FFMpegImageStream..."<<std::endl;
+
     quit(true);
 
+    // destroy the decoder and associated threads
+    m_decoder = 0;
+
+
     delete m_commands;
+
+    osg::notify(osg::NOTICE)<<"Destructed FFMpegImageStream."<<std::endl;
 }
 
Index: /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp (revision 9860)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp (revision 9861)
@@ -9,5 +9,4 @@
 #include "FFmpegPacket.hpp"
 
-#include <boost/shared_ptr.hpp>
 #include <OpenThreads/Thread>
 #include <vector>
@@ -86,5 +85,4 @@
     void findAspectRatio();
     void publishFrame(double delay);
-    void swapBuffers();
     double synchronizeVideo(double pts);
     void yuva420pToRgba(AVPicture *dst, const AVPicture *src, int width, int height);
