diff options
-rw-r--r-- | media/libstagefright/ACodec.cpp | 9 | ||||
-rw-r--r-- | media/libstagefright/Android.mk | 4 | ||||
-rw-r--r-- | media/libstagefright/OMXCodec.cpp | 10 |
3 files changed, 22 insertions, 1 deletions
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); diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk index 725789a..6c37819 100644 --- a/media/libstagefright/Android.mk +++ b/media/libstagefright/Android.mk @@ -161,6 +161,10 @@ ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) LOCAL_CFLAGS += -DENABLE_STAGEFRIGHT_EXPERIMENTS endif +ifeq ($(TARGET_BOARD_PLATFORM),omap4) +LOCAL_CFLAGS += -DBOARD_CANT_REALLOCATE_OMX_BUFFERS +endif + LOCAL_CLANG := true ifeq ($(BOARD_USE_SAMSUNG_CAMERAFORMAT_NV21), true) diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 194edd5..b2bfceb 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -1865,7 +1865,12 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { // plus an extra buffer to account for incorrect minUndequeuedBufs CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1", def.nBufferCountMin, def.nBufferCountActual, 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 + minUndequeuedBufs) { +#endif for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) { OMX_U32 newBufferCount = def.nBufferCountMin + minUndequeuedBufs + extraBuffers; @@ -1887,6 +1892,9 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { } CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1", def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs); +#ifdef BOARD_CANT_REALLOCATE_OMX_BUFFERS + } +#endif err = native_window_set_buffer_count( mNativeWindow.get(), def.nBufferCountActual); |