[vlc-commits] input: only flush/stop vout if actually started

Rémi Denis-Courmont git at videolan.org
Mon Apr 1 18:25:42 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr  1 19:23:56 2019 +0300| [7221c0dc321a74cb0a50a7dce0d57cbcd6644873] | committer: Rémi Denis-Courmont

input: only flush/stop vout if actually started

This moves the flushing and stopping of the vout thread out of
input_resource_PutVout() and to its original call site in decoder.c.

In the new call site within resource.c, the vout thread is not actually
started and cannot be flushed and stopped.

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

 src/input/decoder.c  | 17 +++++++++++------
 src/input/resource.c |  3 ---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 82e3fe781f..36b5ac8f89 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1942,21 +1942,26 @@ static void DeleteDecoder( decoder_t * p_dec )
                 input_resource_PutAout( p_owner->p_resource, p_owner->p_aout );
             }
             break;
-        case VIDEO_ES:
-            if( p_owner->p_vout )
+        case VIDEO_ES: {
+            vout_thread_t *vout = p_owner->p_vout;
+
+            if (vout != NULL)
             {
                 /* Reset the cancel state that was set before joining the decoder
                  * thread */
-                vout_Cancel( p_owner->p_vout, false );
-
+                vout_Cancel(vout, false);
+                vout_FlushAll(vout);
+                vout_FlushSubpictureChannel(vout, -1);
+                vout_Stop(vout);
                 input_SendEventVout(p_owner->p_input,
                     &(struct vlc_input_event_vout) {
                         .action = VLC_INPUT_EVENT_VOUT_DELETED,
-                        .vout = p_owner->p_vout,
+                        .vout = vout,
                     });
-                input_resource_PutVout( p_owner->p_resource, p_owner->p_vout );
+                input_resource_PutVout(p_owner->p_resource, vout);
             }
             break;
+        }
         case SPU_ES:
         {
             if( p_owner->p_vout )
diff --git a/src/input/resource.c b/src/input/resource.c
index 8a0b02ddbb..e8fcd6d6d5 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -439,9 +439,6 @@ void input_resource_PutVout(input_resource_t *p_resource,
         vout_Close(vout);
     } else {
         msg_Dbg(p_resource->p_parent, "saving a free vout");
-        vout_FlushAll(vout);
-        vout_FlushSubpictureChannel(vout, -1);
-        vout_Stop(vout);
         p_resource->p_vout_free = vout;
     }
     vlc_mutex_unlock( &p_resource->lock );



More information about the vlc-commits mailing list