Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c07c9f4 authored by Michael Gernoth's avatar Michael Gernoth Committed by Gerrit Code Review
Browse files

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.

Change-Id: I9c1267c2a2a755bc16448a6049cb2e4aff0b65bb
parent c52399b3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -760,6 +760,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;
@@ -779,6 +785,9 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
            return err;
        }
    }
#ifdef BOARD_CANT_REALLOCATE_OMX_BUFFERS
    }
#endif

    err = native_window_set_buffer_count(
            mNativeWindow.get(), def.nBufferCountActual);
+4 −0
Original line number Diff line number Diff line
@@ -120,6 +120,10 @@ endif
endif
endif

ifeq ($(TARGET_BOARD_PLATFORM),omap4)
LOCAL_CFLAGS := -DBOARD_CANT_REALLOCATE_OMX_BUFFERS
endif

#QTI FLAC Decoder
ifeq ($(call is-vendor-board-platform,QCOM),true)
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio