From 6652c2586368bfaf14799b06be4eb91d5d21fed9 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Mon, 24 Nov 2014 21:25:28 +0100 Subject: libstagefright: Make it possible to skip OMX buffer reallocation Some devices don't like the call to setParameter() at this point, so skip this call if enough buffers are already allocated. This check was present in KitKat but got removed when code to allocate extra- buffers was introduced. This is activated only for omap4 for now. Squashed 2nd commit: which does same for OMXCodec.cpp Change-Id: I9c1267c2a2a755bc16448a6049cb2e4aff0b65bb --- media/libstagefright/ACodec.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'media/libstagefright/ACodec.cpp') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 9548db0..ebe8046 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -983,6 +983,12 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( // 2. try to allocate two (2) additional buffers to reduce starvation from // the consumer // plus an extra buffer to account for incorrect minUndequeuedBufs +#ifdef BOARD_CANT_REALLOCATE_OMX_BUFFERS + // Some devices don't like to set OMX_IndexParamPortDefinition at this + // point (even with an unmodified def), so skip it if possible. + // This check was present in KitKat. + if (def.nBufferCountActual < def.nBufferCountMin + *minUndequeuedBuffers) { +#endif for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) { OMX_U32 newBufferCount = def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers; @@ -1002,6 +1008,9 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( return err; } } +#ifdef BOARD_CANT_REALLOCATE_OMX_BUFFERS + } +#endif err = native_window_set_buffer_count( mNativeWindow.get(), def.nBufferCountActual); -- cgit v1.1