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

Commit 0bfe2cad authored by Praveen Chavan's avatar Praveen Chavan Committed by Steve Kondik
Browse files

stagefright: add an extra buffer to ANW's BUfferQueue

Add an extra buffer to ensure video player has a free buffer to
dequeue rather than wait for the queued buffer to be displayed.
Enable logs to indicate number of buffers allocated.

NOTE: This is not needed for 30fps content on 60fps panel, But
making this change regardless for all framerates till root-cause
is identified in SF

Change-Id: Id1048d7a104b2a75613dda8b9cf166e59bc4bb04

stagefright: ACodec: add an extra buffer to ANW's BUfferQueue

Add an extra min-undequeued buffer to ensure framework (ACodec)
has a free buffer to dequeue rather than wait for the queued buffer
to be displayed
This improves the performance of playback via nuPlayer.

Change-Id: If02a91f8121b7a2664c0264498c7b7e3031a88d7
CRs-Fixed: 607794

stagefright: Increase buffers with nativewindow

To avoid frame-drops due to latencies in rendering.

If (minUnDequeued) buffers are caught in display pipeline,
dequeueBuffer will block, which delays subsequent queuebuffer,
and this repeats until a buffer is canceled (frame drop).
This issue is more prominent with high resolution content
on secondary displays.

Adding additional buffers increases the stagger in display
and makes finding a free buffer more likely

Change-Id: I352a77ffcd67c8fdd1c2485e3737ba923950f8fd
CRs-Fixed: 714475
parent 84565432
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -663,6 +663,14 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
        return err;
    }

#ifdef QCOM_HARDWARE
    //add an extra buffer to display queue to get around dequeue+wait
    //blocking too long (more than 1 Vsync) in case BufferQeuue is in
    //sync-mode and advertizes only 1 buffer
    (*minUndequeuedBuffers)++;
    ALOGI("NOTE: Overriding minUndequeuedBuffers to %lu",*minUndequeuedBuffers);
#endif

    // XXX: Is this the right logic to use?  It's not clear to me what the OMX
    // buffer counts refer to - how do they account for the renderer holding on
    // to buffers?
+11 −0
Original line number Diff line number Diff line
@@ -2426,12 +2426,23 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
        return err;
    }

#ifdef QCOM_HARDWARE
    // Add extra buffer to display queue to get around dequeue+wait
    // blocking too long in case BufferQueue is in sync-mode and advertises
    // only 1 buffer. Also, restrict to 2 extra buffers for > 1080p
    minUndequeuedBufs +=
        (def.format.video.nFrameWidth * def.format.video.nFrameHeight > 1088 * 1920)
        ? 2 : 3;
    ALOGI("NOTE: Overriding minUndequeuedBufs to %d",minUndequeuedBufs);
#endif

    // XXX: Is this the right logic to use?  It's not clear to me what the OMX
    // buffer counts refer to - how do they account for the renderer holding on
    // to buffers?
    if (def.nBufferCountActual < def.nBufferCountMin + minUndequeuedBufs) {
        OMX_U32 newBufferCount = def.nBufferCountMin + minUndequeuedBufs;
        def.nBufferCountActual = newBufferCount;
        ALOGI("NOTE: Allocating %lu buffers on output port",def.nBufferCountActual);
        err = mOMX->setParameter(
                mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
        if (err != OK) {