Commit 0c32fe97 authored by John Freed's avatar John Freed Committed by Jean-Baptiste Kempf

DShow: Remove filters but don't Release() them

Fixes undocumented/poorly documented Windows behavior. RemoveFilter function does a silent Release().
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 3f6ccc0d79eae7c684f6b406e4eefb458a50bb00)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent e5fbc2d1
...@@ -363,17 +363,23 @@ static void CreateDirectShowGraph( access_sys_t *p_sys ) ...@@ -363,17 +363,23 @@ static void CreateDirectShowGraph( access_sys_t *p_sys )
} }
} }
static void DeleteDirectShowGraph( access_sys_t *p_sys ) static void DeleteDirectShowGraph( vlc_object_t *p_this, access_sys_t *p_sys )
{ {
DeleteCrossbarRoutes( p_sys ); DeleteCrossbarRoutes( p_sys );
/* Remove filters from graph */ /* Remove filters from graph */
msg_Dbg( p_this, "DeleteDirectShowGraph: Removing filters" );
for( int i = 0; i < p_sys->i_streams; i++ ) for( int i = 0; i < p_sys->i_streams; i++ )
{ {
/* RemoveFilter does an undocumented Release()
* but does not set item to NULL */
msg_Dbg( p_this, "DeleteDirectShowGraph: Removing capture filter" );
p_sys->p_graph->RemoveFilter( p_sys->pp_streams[i]->p_capture_filter ); p_sys->p_graph->RemoveFilter( p_sys->pp_streams[i]->p_capture_filter );
p_sys->pp_streams[i]->p_capture_filter = NULL;
msg_Dbg( p_this, "DeleteDirectShowGraph: Removing device filter" );
p_sys->p_graph->RemoveFilter( p_sys->pp_streams[i]->p_device_filter ); p_sys->p_graph->RemoveFilter( p_sys->pp_streams[i]->p_device_filter );
p_sys->pp_streams[i]->p_capture_filter->Release(); p_sys->pp_streams[i]->p_device_filter = NULL;
p_sys->pp_streams[i]->p_device_filter->Release();
} }
/* Release directshow objects */ /* Release directshow objects */
...@@ -837,7 +843,7 @@ static void CommonClose( vlc_object_t *p_this, access_sys_t *p_sys ) ...@@ -837,7 +843,7 @@ static void CommonClose( vlc_object_t *p_this, access_sys_t *p_sys )
{ {
msg_Dbg( p_this, "releasing DirectShow"); msg_Dbg( p_this, "releasing DirectShow");
DeleteDirectShowGraph( p_sys ); DeleteDirectShowGraph( p_this, p_sys );
/* Uninitialize OLE/COM */ /* Uninitialize OLE/COM */
CoUninitialize(); CoUninitialize();
...@@ -1197,12 +1203,16 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys, ...@@ -1197,12 +1203,16 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
fail: fail:
/* Remove filters from graph */ /* Remove filters from graph */
msg_Dbg( p_this, "OpenDevice: Removing filters" ) ;
p_sys->p_graph->RemoveFilter( p_device_filter ); p_sys->p_graph->RemoveFilter( p_device_filter );
p_sys->p_graph->RemoveFilter( p_capture_filter ); p_sys->p_graph->RemoveFilter( p_capture_filter );
/* Release objects */ /* Release objects */
p_device_filter->Release(); /* RemoveFilter does an undocumented Release()
p_capture_filter->Release(); * but does not set item to NULL*/
p_device_filter = NULL;
p_capture_filter = NULL;
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
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