[vlc-commits] codec: videotoolbox: force a vout flush with 4K10bits on iOS

Thomas Guillem git at videolan.org
Fri Nov 24 13:12:09 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Nov 24 09:17:47 2017 +0100| [db7820b638e2626612f5685f78805eb2437f8a16] | committer: Thomas Guillem

codec: videotoolbox: force a vout flush with 4K10bits on iOS

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

 modules/codec/videotoolbox.m | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 61993003ad..023f71282d 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1197,6 +1197,24 @@ static void StopVideoToolbox(decoder_t *p_dec, bool b_reset_format)
         CFRelease(p_sys->session);
         p_sys->session = nil;
 
+#if TARGET_OS_IPHONE
+        /* In case of 4K 10bits (BGRA), we can easily reach the device max
+         * memory when flushing. Indeed, we'll create a new VT session that
+         * will reallocate frames while previous frames are still used by the
+         * vout (and not released). To work-around this issue, we force a vout
+         * change. */
+        if (p_dec->fmt_out.i_codec == VLC_CODEC_CVPX_BGRA
+         && p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height >= 8000000)
+        {
+            const video_format_t orig = p_dec->fmt_out.video;
+            p_dec->fmt_out.video.i_width = p_dec->fmt_out.video.i_height =
+            p_dec->fmt_out.video.i_visible_width = p_dec->fmt_out.video.i_visible_height = 64;
+            (void) decoder_UpdateVideoFormat(p_dec);
+            p_dec->fmt_out.video = orig;
+            b_reset_format = true;
+        }
+#endif
+
         if (b_reset_format)
         {
             p_sys->b_format_propagated = false;



More information about the vlc-commits mailing list