[vlc-commits] access: use vlc_killed()

Rémi Denis-Courmont git at videolan.org
Wed Jul 1 18:22:14 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jun 30 23:52:51 2015 +0300| [62d9e9b218731692c7c2dafea69086a9822fa532] | committer: Rémi Denis-Courmont

access: use vlc_killed()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62d9e9b218731692c7c2dafea69086a9822fa532
---

 modules/access/avio.c       |    8 +++++++-
 modules/access/dvb/access.c |    2 +-
 modules/access/live555.cpp  |    5 ++++-
 modules/access/mms/mmstu.c  |    2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/access/avio.c b/modules/access/avio.c
index 50ef585..3a1a9b4 100644
--- a/modules/access/avio.c
+++ b/modules/access/avio.c
@@ -31,6 +31,7 @@
 #include <vlc_access.h>
 #include <vlc_sout.h>
 #include <vlc_avcodec.h>
+#include <vlc_interrupt.h>
 
 #include "avio.h"
 #include "../codec/avcodec/avcommon.h"
@@ -70,7 +71,12 @@ static int     OutSeek (sout_access_out_t *, off_t);
 
 static int UrlInterruptCallback(void *access)
 {
-    return !vlc_object_alive((access_t *)access);
+    /* NOTE: This works so long as libavformat invokes the callback from the
+     * same thread that invokes libavformat. Currently libavformat does not
+     * create internal threads at all. This is not proper event handling in any
+     * case; libavformat needs fixing. */
+    (void) access;
+    return vlc_killed();
 }
 
 struct access_sys_t
diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index 0215e2a..348f7d7 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -285,7 +285,7 @@ static block_t *BlockScan( access_t *p_access )
 
             i_ret = 0;
 
-            if( !vlc_object_alive (p_access) || scan_IsCancelled( p_scan ) )
+            if( vlc_killed() || scan_IsCancelled( p_scan ) )
                 break;
 
             if( timeout >= 0 )
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index fef590a..159315c 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -41,6 +41,7 @@
 #include <vlc_dialog.h>
 #include <vlc_url.h>
 #include <vlc_strings.h>
+#include <vlc_interrupt.h>
 
 #include <limits.h>
 #include <assert.h>
@@ -584,7 +585,9 @@ static int Connect( demux_t *p_demux )
     }
 
 createnew:
-    if( !vlc_object_alive (p_demux) )
+    /* FIXME: This is naive and incorrect; it does not prevent the thread
+     * getting stuck in blocking socket operations. */
+    if( vlc_killed() )
     {
         i_ret = VLC_EGENERIC;
         goto bailout;
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index e8aaf04..662c4e5 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -1060,7 +1060,7 @@ static int NetFillBuffer( access_t *p_access )
 
     do
     {
-        if( !vlc_object_alive (p_access) )
+        if( vlc_killed() )
             return -1;
 
         i_ret = vlc_poll_i11e(ufd, nfd, timeout);



More information about the vlc-commits mailing list