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

Commit f5ee3277 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

DO NOT MERGE: Revert "stagefright: allow for minUndequeuedBufs to be one less"

This reverts commit a0470879.

Bug: 13655631
parent f622e2c7
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -640,8 +640,8 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(

    // FIXME: assume that surface is controlled by app (native window
    // returns the number for the case when surface is not controlled by app)
    // FIXME2: This means that minUndeqeueudBufs can be 1 larger than reported
    // For now, try to allocate 1 more buffer, but don't fail if unsuccessful
    (*minUndequeuedBuffers)++;


    // Use conservative allocation while also trying to reduce starvation
    //
@@ -649,8 +649,7 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
    //    minimum needed for the consumer to be able to work
    // 2. try to allocate two (2) additional buffers to reduce starvation from
    //    the consumer
    //    plus an extra buffer to account for incorrect minUndequeuedBufs
    for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
    for (OMX_U32 extraBuffers = 2; /* condition inside loop */; extraBuffers--) {
        OMX_U32 newBufferCount =
            def.nBufferCountMin + *minUndequeuedBuffers + extraBuffers;
        def.nBufferCountActual = newBufferCount;
+4 −6
Original line number Diff line number Diff line
@@ -1780,8 +1780,7 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
    }
    // FIXME: assume that surface is controlled by app (native window
    // returns the number for the case when surface is not controlled by app)
    // FIXME2: This means that minUndeqeueudBufs can be 1 larger than reported
    // For now, try to allocate 1 more buffer, but don't fail if unsuccessful
    minUndequeuedBufs++;

    // Use conservative allocation while also trying to reduce starvation
    //
@@ -1789,11 +1788,10 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
    //    minimum needed for the consumer to be able to work
    // 2. try to allocate two (2) additional buffers to reduce starvation from
    //    the consumer
    //    plus an extra buffer to account for incorrect minUndequeuedBufs
    CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1",
    CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d",
            def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs);

    for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
    for (OMX_U32 extraBuffers = 2; /* condition inside loop */; extraBuffers--) {
        OMX_U32 newBufferCount =
            def.nBufferCountMin + minUndequeuedBufs + extraBuffers;
        def.nBufferCountActual = newBufferCount;
@@ -1812,7 +1810,7 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
            return err;
        }
    }
    CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1",
    CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d",
            def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs);

    err = native_window_set_buffer_count(