From 729c39381da86cf7756530f3ff2f750550ffef93 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 8 Oct 2009 08:41:11 -0700 Subject: [PATCH] Insert a small delay after submitting to surface flinger and before returning the buffer to the decoder. Since we cannot tell how long it'll take until surface flinger has displayed the data onscreen, we'll just have to guess... We must not return the buffer to the decoder before it's been displayed. --- media/libstagefright/omx/QComHardwareRenderer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/libstagefright/omx/QComHardwareRenderer.cpp b/media/libstagefright/omx/QComHardwareRenderer.cpp index e9930be0b164e..7dc368f16520e 100644 --- a/media/libstagefright/omx/QComHardwareRenderer.cpp +++ b/media/libstagefright/omx/QComHardwareRenderer.cpp @@ -83,6 +83,11 @@ void QComHardwareRenderer::render( } mISurface->postBuffer(offset); + + // Since we cannot tell how long it'll take until surface flinger + // has displayed the data onscreen, we'll just have to guess... + // We must not return the buffer to the decoder before it's been displayed. + usleep(25000); } bool QComHardwareRenderer::getOffset(void *platformPrivate, size_t *offset) {