]> git.sesse.net Git - vlc/blobdiff - modules/access/dshow/filter.cpp
backport [13275]
[vlc] / modules / access / dshow / filter.cpp
index 8e2eee29be87987d5020cc81818b382f1fc5c101..2622b2e3ca6c43a2f6086ab892e74d00ca49e828 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * filter.c : DirectShow access module for vlc
  *****************************************************************************
- * Copyright (C) 2002 VideoLAN
+ * Copyright (C) 2002 the VideoLAN team
  * $Id$
  *
  * Author: Gildas Bazin <gbazin@videolan.org>
@@ -506,18 +506,7 @@ STDMETHODIMP CapturePin::Disconnect()
 
     msg_Dbg( p_input, "CapturePin::Disconnect [OK]" );
 
-#if 0 // FIXME: This does seem to create crashes sometimes
-    VLCMediaSample vlc_sample;
-
-    vlc_mutex_lock( &p_sys->lock );
-    while( samples_queue.size() )
-    {
-        vlc_sample = samples_queue.back();
-        samples_queue.pop_back();
-        vlc_sample.p_sample->Release();
-    }
-    vlc_mutex_unlock( &p_sys->lock );
-#endif
+    /* samples_queue was already flushed in EndFlush() */
 
     p_connected_pin->Release();
     p_connected_pin = NULL;
@@ -683,6 +672,18 @@ STDMETHODIMP CapturePin::EndFlush( void )
 #ifdef DEBUG_DSHOW
     msg_Dbg( p_input, "CapturePin::EndFlush" );
 #endif
+
+    VLCMediaSample vlc_sample;
+
+    vlc_mutex_lock( &p_sys->lock );
+    while( samples_queue.size() )
+    {
+        vlc_sample = samples_queue.back();
+        samples_queue.pop_back();
+        vlc_sample.p_sample->Release();
+    }
+    vlc_mutex_unlock( &p_sys->lock );
+
     return S_OK;
 }
 STDMETHODIMP CapturePin::NewSegment( REFERENCE_TIME tStart,
@@ -898,6 +899,8 @@ STDMETHODIMP CaptureFilter::Stop()
     msg_Dbg( p_input, "CaptureFilter::Stop" );
 #endif
 
+    p_pin->EndFlush();
+
     state = State_Stopped;
     return S_OK;
 };