diff options
author | Michael Gernoth <michael@gernoth.net> | 2014-11-24 21:25:28 +0100 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2015-11-07 01:24:14 -0800 |
commit | 6652c2586368bfaf14799b06be4eb91d5d21fed9 (patch) | |
tree | 901deeb77f976f081d4ef419f4041e775d0d3803 /media/libstagefright | |
parent | 6b33144d873c32afb456028416939d096e88b186 (diff) | |
download | frameworks_av-6652c2586368bfaf14799b06be4eb91d5d21fed9.zip frameworks_av-6652c2586368bfaf14799b06be4eb91d5d21fed9.tar.gz frameworks_av-6652c2586368bfaf14799b06be4eb91d5d21fed9.tar.bz2 |
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
Diffstat (limited to 'media/libstagefright')
-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); |