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

Commit 883dbe74 authored by Ziyan's avatar Ziyan Committed by Dániel Járai
Browse files

libstagefright: Make it possible to skip OMX buffer reallocation (2)

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.

Based on, and requires http://review.cyanogenmod.org/#/c/79137/

This patch skips another possible buffer reallocation, which
can be fatal on these devices.

Change-Id: Iae33c69e7fa5acf2f720ad67f2eb17697f6ad8ef
parent d3154d5e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -2253,7 +2253,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;
@@ -2275,6 +2280,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);