]> git.sesse.net Git - vlc/commitdiff
* modules/access/dshow: flush the capture pin's buffers when the capture filter is...
authorGildas Bazin <gbazin@videolan.org>
Mon, 7 Mar 2005 16:33:56 +0000 (16:33 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 7 Mar 2005 16:33:56 +0000 (16:33 +0000)
modules/access/dshow/filter.cpp

index d048ada371a6f843ced9b899f486c1ecf77cafbe..68168c53185e63da59f4ecdc75582755d8a8765c 100644 (file)
@@ -506,18 +506,7 @@ STDMETHODIMP CapturePin::Disconnect()
 
     msg_Dbg( p_input, "CapturePin::Disconnect [OK]" );
 
-#if 1 // This used to create crashes sometimes. Is the problem fixed ?
-    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;
 };