[vlc-devel] [PATCH] DirectShow: Check for IMediaControl::Run failure

Salah-Eddin Shaban salah at videolan.org
Sat Feb 4 00:07:33 CET 2017


Close #9161
---
 modules/access/dshow/dshow.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 6204862..d636337 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -673,7 +673,12 @@ static int DemuxOpen( vlc_object_t *p_this )
 
     /* Everything is ready. Let's rock baby */
     msg_Dbg( p_this, "Playing...");
-    p_sys->p_control->Run();
+    if( FAILED( p_sys->p_control->Run() ) )
+    {
+        msg_Err( p_this, "Failed to run graph. Capture device may be in use." );
+        CommonClose( p_this, p_sys );
+        return VLC_EGENERIC;
+    }
 
     p_demux->pf_demux   = Demux;
     p_demux->pf_control = DemuxControl;
@@ -779,7 +784,12 @@ static int AccessOpen( vlc_object_t *p_this )
 
     /* Everything is ready. Let's rock baby */
     msg_Dbg( p_this, "Playing...");
-    p_sys->p_control->Run();
+    if( FAILED( p_sys->p_control->Run() ) )
+    {
+        msg_Err( p_this, "Failed to run graph. Capture device may be in use." );
+        CommonClose( p_this, p_sys );
+        return VLC_EGENERIC;
+    }
 
     return VLC_SUCCESS;
 }
-- 
2.6.6



More information about the vlc-devel mailing list