vlc | branch: master | Martin Storsjö <[email protected]> | Sun Sep 22 20:00:12 
2013 +0300| [b8b8f03e002f43ca8de15b6eec88942e891fbcd5] | committer: Martin 
Storsjö

mediacodec: Don't return frames before the output format is set

The decoder on Sony Xperia Z1 seems to return one frame before
the output format is set (and calling getOutputFormat() at this
point throws an IllegalStateException). Therefore just drop any
frames that are returned before the output format has been set.

Signed-off-by: Martin Storsjö <[email protected]>

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

 modules/codec/omxil/android_mediacodec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/codec/omxil/android_mediacodec.c 
b/modules/codec/omxil/android_mediacodec.c
index c4b712c..792f0ec 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -398,6 +398,11 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, 
picture_t **pp_pic, int loo
         int index = (*env)->CallIntMethod(env, p_sys->codec, 
p_sys->dequeue_output_buffer,
                                           p_sys->buffer_info, (jlong) 0);
         if (index >= 0) {
+            if (!p_sys->pixel_format) {
+                msg_Warn(p_dec, "Buffers returned before output format is set, 
dropping frame");
+                (*env)->CallVoidMethod(env, p_sys->codec, 
p_sys->release_output_buffer, index, false);
+                continue;
+            }
             jobject buf = (*env)->GetObjectArrayElement(env, 
p_sys->output_buffers, index);
             jsize buf_size = (*env)->GetDirectBufferCapacity(env, buf);
             uint8_t *ptr = (*env)->GetDirectBufferAddress(env, buf);

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

Reply via email to