diff options
author | Benny Wong <Benny.Wong@motorola.com> | 2009-08-18 13:32:47 -0500 |
---|---|---|
committer | Rebecca Schultz Zavin <rebecca@android.com> | 2009-08-19 18:13:01 -0700 |
commit | 02bd7a1a98bc8a3a124e1e4554a78439e26b4caf (patch) | |
tree | 247f3f6fee6dd72c1e4f4b50a7ec32397dc4f3a7 /libopencorehw | |
parent | 31fe63f0022f74595e2acf6a0114f82c97554ae1 (diff) | |
download | omap3-02bd7a1a98bc8a3a124e1e4554a78439e26b4caf.tar.gz |
Wait for first frame to finish queuing to avoid delays
Diffstat (limited to 'libopencorehw')
-rw-r--r-- | libopencorehw/android_surface_output_omap34xx.cpp | 19 | ||||
-rw-r--r-- | libopencorehw/android_surface_output_omap34xx.h | 1 |
2 files changed, 17 insertions, 3 deletions
diff --git a/libopencorehw/android_surface_output_omap34xx.cpp b/libopencorehw/android_surface_output_omap34xx.cpp index 6a92773..0300a12 100644 --- a/libopencorehw/android_surface_output_omap34xx.cpp +++ b/libopencorehw/android_surface_output_omap34xx.cpp @@ -63,6 +63,7 @@ OSCL_EXPORT_REF AndroidSurfaceOutputOmap34xx::AndroidSurfaceOutputOmap34xx() : { mUseOverlay = true; mOverlay = NULL; + mIsFirstFrame = true; } OSCL_EXPORT_REF AndroidSurfaceOutputOmap34xx::~AndroidSurfaceOutputOmap34xx() @@ -170,9 +171,21 @@ PVMFStatus AndroidSurfaceOutputOmap34xx::writeFrameBuf(uint8* aData, uint32 aDat bufEnc = i; mOverlay->queueBuffer((void*)bufEnc); overlay_buffer_t overlay_buffer; - if (mOverlay->dequeueBuffer(&overlay_buffer) != NO_ERROR) { - LOGE("Video (34xx)MIO dequeue buffer failed"); - return false; + + /* This is to prevent dequeueBuffer to be called before the first + * queueBuffer call is done. If that happens, there will be a delay + * as the dequeueBuffer call will be blocked. + */ + if (!mIsFirstFrame) + { + if (mOverlay->dequeueBuffer(&overlay_buffer) != NO_ERROR) { + LOGE("Video (34xx)MIO dequeue buffer failed"); + return false; + } + } + else + { + mIsFirstFrame = false; } } return PVMFSuccess; diff --git a/libopencorehw/android_surface_output_omap34xx.h b/libopencorehw/android_surface_output_omap34xx.h index c88e010..c40f66c 100644 --- a/libopencorehw/android_surface_output_omap34xx.h +++ b/libopencorehw/android_surface_output_omap34xx.h @@ -68,6 +68,7 @@ class AndroidSurfaceOutputOmap34xx : public AndroidSurfaceOutput int32 iNumberOfBuffers; int32 iBufferSize; + bool mIsFirstFrame; public: BufferAllocOmap34xx mbufferAlloc; }; |