Index: OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp
===================================================================
--- OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp (revision 9861)
+++ OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp (revision 9869)
@@ -43,4 +43,10 @@
 
     quit(true);
+    
+    osg::notify(osg::NOTICE)<<"Have done quit"<<std::endl;
+
+    // release athe audio streams to make sure that the decoder doesn't retain any external
+    // refences.
+    getAudioStreams().clear();
 
     // destroy the decoder and associated threads
@@ -131,5 +137,5 @@
 
     // Close the decoder (i.e. flush the decoder packet queues)
-    m_decoder->close();
+    m_decoder->close(waitForThreadToExit);
 }
 
@@ -198,4 +204,6 @@
         osg::notify(osg::WARN) << "FFmpegImageStream::run : unhandled exception" << std::endl;
     }
+    
+    osg::notify(osg::NOTICE)<<"Finished FFmpegImageStream::run()"<<std::endl;
 }
 
