vlc | branch: master | Thomas Guillem <[email protected]> | Thu Jan 19 18:57:29 
2017 +0100| [c642b422a17c6f996d1447bf31e7494e958e5721] | committer: Thomas 
Guillem

videotoolbox: implement drain

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

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

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 43b2c04..f71c50b 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -752,8 +752,6 @@ static void CloseDecoder(vlc_object_t *p_this)
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if (p_sys->session)
-        VTDecompressionSessionWaitForAsynchronousFrames(p_sys->session);
     StopVideoToolbox(p_dec);
 
     vlc_mutex_destroy(&p_sys->lock);
@@ -1031,7 +1029,15 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t 
**pp_block)
     int i_ret = 0;
 
     if (!pp_block)
-        return NULL;
+    {
+        /* draining: return last pictures of the reordered queue */
+        if (p_sys->session)
+            VTDecompressionSessionWaitForAsynchronousFrames(p_sys->session);
+        vlc_mutex_lock(&p_sys->lock);
+        picture_t *p_pic = PicReorder_pop(p_dec, true);
+        vlc_mutex_unlock(&p_sys->lock);
+        return p_pic;
+    }
 
     p_block = *pp_block;
 

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to