[vlc-commits] codec: videotoolbox: fix seek speed

Thomas Guillem git at videolan.org
Tue Sep 12 16:11:25 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Sep 12 16:08:40 2017 +0200| [4d3db12036b6dd05075c0db1238907e13a7e0033] | committer: Thomas Guillem

codec: videotoolbox: fix seek speed

Do not output video frames while flushing.

Fixes #18799

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

 modules/codec/videotoolbox.m | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 3c2d3e1a07..579133211c 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1311,7 +1311,9 @@ static void Flush(decoder_t *p_dec)
     /* There is no Flush in VT api, ask to restart VT from next DecodeBlock if
      * we already feed some input blocks (it's better to not restart here in
      * order to avoid useless restart just before a close). */
+    vlc_mutex_lock(&p_sys->lock);
     p_sys->b_vt_flush = p_sys->b_vt_feed;
+    vlc_mutex_unlock(&p_sys->lock);
 }
 
 static void Drain(decoder_t *p_dec)
@@ -1338,10 +1340,8 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if (p_sys->b_vt_flush) {
+    if (p_sys->b_vt_flush)
         RestartVideoToolbox(p_dec, false);
-        p_sys->b_vt_flush = false;
-    }
 
     if (p_block == NULL)
     {
@@ -1350,6 +1350,8 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
     }
 
     vlc_mutex_lock(&p_sys->lock);
+    p_sys->b_vt_flush = false;
+
     if (p_sys->b_abort) { /* abort from output thread (DecoderCallback) */
         vlc_mutex_unlock(&p_sys->lock);
         /* Add an empty variable so that videotoolbox won't be loaded again for
@@ -1590,6 +1592,8 @@ static void DecoderCallback(void *decompressionOutputRefCon,
     frame_info_t *p_info = (frame_info_t *) sourceFrameRefCon;
 
     vlc_mutex_lock(&p_sys->lock);
+    if (p_sys->b_vt_flush)
+        goto end;
 
     if (HandleVTStatus(p_dec, status) != VLC_SUCCESS)
     {



More information about the vlc-commits mailing list