[vlc-commits] mediacodec: ensure that surface is released before starting direct rendering

Thomas Guillem git at videolan.org
Fri Aug 28 18:54:57 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Aug 28 18:53:51 2015 +0200| [4125beededb95d27d46bc07cc80fe073fe36ef3c] | committer: Thomas Guillem

mediacodec: ensure that surface is released before starting direct rendering

This fixes an error when switching from 2 Es with different codecs.

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

 modules/codec/omxil/mediacodec.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 4f74508..a774e5c 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -390,7 +390,20 @@ static int StartMediaCodec(decoder_t *p_dec)
         }
 
         if (!p_sys->u.video.p_awh && var_InheritBool(p_dec, CFG_PREFIX "dr"))
-            p_sys->u.video.p_awh = AWindowHandler_new(VLC_OBJECT(p_dec));
+        {
+            if ((p_sys->u.video.p_awh = AWindowHandler_new(VLC_OBJECT(p_dec))))
+            {
+                /* Direct rendering:
+                 * The surface must be released by the Vout before calling
+                 * start. Request a valid OPAQUE Vout to release any non-OPAQUE
+                 * Vout that will release the surface.
+                 */
+                p_dec->fmt_out.video.i_width = p_sys->u.video.i_width;
+                p_dec->fmt_out.video.i_height = p_sys->u.video.i_height;
+                p_dec->fmt_out.i_codec = VLC_CODEC_ANDROID_OPAQUE;
+                decoder_UpdateVideoFormat(p_dec);
+            }
+        }
         args.video.p_awh = p_sys->u.video.p_awh;
     }
     else



More information about the vlc-commits mailing list