Commit 5e77519c authored by Gildas Bazin's avatar Gildas Bazin

* modules/access/dshow/*: fixed a problem when we would sometimes get stuck...

* modules/access/dshow/*: fixed a problem when we would sometimes get stuck trying to stop the dshow graph.
parent 882e383a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dshow.cpp : DirectShow access module for vlc * dshow.cpp : DirectShow access module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: dshow.cpp,v 1.20 2003/12/04 17:15:59 gbazin Exp $ * $Id: dshow.cpp,v 1.21 2003/12/15 00:47:18 gbazin Exp $
* *
* Author: Gildas Bazin <gbazin@netcourrier.com> * Author: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -385,7 +385,7 @@ static void AccessClose( vlc_object_t *p_this ) ...@@ -385,7 +385,7 @@ static void AccessClose( vlc_object_t *p_this )
access_sys_t *p_sys = p_input->p_access_data; access_sys_t *p_sys = p_input->p_access_data;
/* Stop capturing stuff */ /* Stop capturing stuff */
p_sys->p_control->Stop(); //p_sys->p_control->Stop(); /* FIXME?: we get stuck here sometimes */
p_sys->p_control->Release(); p_sys->p_control->Release();
/* Remove filters from graph */ /* Remove filters from graph */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* filter.c : DirectShow access module for vlc * filter.c : DirectShow access module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: filter.cpp,v 1.9 2003/12/02 23:03:31 gbazin Exp $ * $Id: filter.cpp,v 1.10 2003/12/15 00:47:18 gbazin Exp $
* *
* Author: Gildas Bazin <gbazin@netcourrier.com> * Author: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -173,16 +173,27 @@ CapturePin::CapturePin( input_thread_t * _p_input, CaptureFilter *_p_filter, ...@@ -173,16 +173,27 @@ CapturePin::CapturePin( input_thread_t * _p_input, CaptureFilter *_p_filter,
CapturePin::~CapturePin() CapturePin::~CapturePin()
{ {
#ifdef DEBUG_DSHOW
msg_Dbg( p_input, "CapturePin::~CapturePin" );
#endif
} }
HRESULT CapturePin::CustomGetSample( VLCMediaSample *vlc_sample ) HRESULT CapturePin::CustomGetSample( VLCMediaSample *vlc_sample )
{ {
#if 0 //def DEBUG_DSHOW
msg_Dbg( p_input, "CapturePin::CustomGetSample" );
#endif
access_sys_t *p_sys = p_input->p_access_data;
vlc_mutex_lock( &p_sys->lock );
if( samples_queue.size() ) if( samples_queue.size() )
{ {
*vlc_sample = samples_queue.back(); *vlc_sample = samples_queue.back();
samples_queue.pop_back(); samples_queue.pop_back();
vlc_mutex_unlock( &p_sys->lock );
return S_OK; return S_OK;
} }
vlc_mutex_unlock( &p_sys->lock );
return S_FALSE; return S_FALSE;
} }
...@@ -283,7 +294,21 @@ STDMETHODIMP CapturePin::Disconnect() ...@@ -283,7 +294,21 @@ STDMETHODIMP CapturePin::Disconnect()
msg_Dbg( p_input, "CapturePin::Disconnect" ); msg_Dbg( p_input, "CapturePin::Disconnect" );
#endif #endif
p_connected_pin->Release(); VLCMediaSample vlc_sample;
access_sys_t *p_sys = p_input->p_access_data;
#if 0 // FIXME: This does seem to create crashes sometimes
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
if( p_connected_pin ) p_connected_pin->Release();
p_connected_pin = NULL; p_connected_pin = NULL;
FreeMediaType( media_type ); FreeMediaType( media_type );
return S_OK; return S_OK;
...@@ -425,8 +450,8 @@ STDMETHODIMP CapturePin::GetAllocatorRequirements( ALLOCATOR_PROPERTIES *pProps ...@@ -425,8 +450,8 @@ STDMETHODIMP CapturePin::GetAllocatorRequirements( ALLOCATOR_PROPERTIES *pProps
} }
STDMETHODIMP CapturePin::Receive( IMediaSample *pSample ) STDMETHODIMP CapturePin::Receive( IMediaSample *pSample )
{ {
#ifdef DEBUG_DSHOW #if 0 //def DEBUG_DSHOW
//msg_Dbg( p_input, "CapturePin::Receive" ); msg_Dbg( p_input, "CapturePin::Receive" );
#endif #endif
pSample->AddRef(); pSample->AddRef();
...@@ -491,6 +516,9 @@ CaptureFilter::CaptureFilter( input_thread_t * _p_input, AM_MEDIA_TYPE mt ) ...@@ -491,6 +516,9 @@ CaptureFilter::CaptureFilter( input_thread_t * _p_input, AM_MEDIA_TYPE mt )
CaptureFilter::~CaptureFilter() CaptureFilter::~CaptureFilter()
{ {
#ifdef DEBUG_DSHOW
msg_Dbg( p_input, "CaptureFilter::~CaptureFilter" );
#endif
p_pin->Release(); p_pin->Release();
} }
...@@ -563,7 +591,7 @@ STDMETHODIMP CaptureFilter::GetClassID(CLSID *pClsID) ...@@ -563,7 +591,7 @@ STDMETHODIMP CaptureFilter::GetClassID(CLSID *pClsID)
STDMETHODIMP CaptureFilter::GetState(DWORD dwMSecs, FILTER_STATE *State) STDMETHODIMP CaptureFilter::GetState(DWORD dwMSecs, FILTER_STATE *State)
{ {
#ifdef DEBUG_DSHOW #ifdef DEBUG_DSHOW
msg_Dbg( p_input, "CaptureFilter::GetStat" ); msg_Dbg( p_input, "CaptureFilter::GetState" );
#endif #endif
return E_NOTIMPL; return E_NOTIMPL;
}; };
...@@ -688,6 +716,9 @@ CaptureEnumPins::CaptureEnumPins( input_thread_t * _p_input, ...@@ -688,6 +716,9 @@ CaptureEnumPins::CaptureEnumPins( input_thread_t * _p_input,
CaptureEnumPins::~CaptureEnumPins() CaptureEnumPins::~CaptureEnumPins()
{ {
#ifdef DEBUG_DSHOW
msg_Dbg( p_input, "CaptureEnumPins::~CaptureEnumPins" );
#endif
p_filter->Release(); p_filter->Release();
} }
...@@ -811,6 +842,9 @@ CaptureEnumMediaTypes::CaptureEnumMediaTypes( input_thread_t * _p_input, ...@@ -811,6 +842,9 @@ CaptureEnumMediaTypes::CaptureEnumMediaTypes( input_thread_t * _p_input,
CaptureEnumMediaTypes::~CaptureEnumMediaTypes() CaptureEnumMediaTypes::~CaptureEnumMediaTypes()
{ {
#ifdef DEBUG_DSHOW
msg_Dbg( p_input, "CaptureEnumMediaTypes::~CaptureEnumMediaTypes" );
#endif
p_pin->Release(); p_pin->Release();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment