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

Commit 2ded8b53 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

stagefright: Fix port-reconfiguration & output-buffer-filled race condition



Remove the invalid assumption that when a port-reconfiguration event
is received, buffers cannot be downstream (waiting to be rendered).

Luckily, these buffers are properly handled (freed) after they are
sent to be rendered.

Also, the case where buffers have been sent onto the native window
is already handled.

Change-Id: I1df39c1ffc2bfb96f8b7b4ee5be07cae654f956f
Signed-off-by: default avatarLajos Molnar <lajos@google.com>
Bug: 8736466
parent c86ef452
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -748,12 +748,10 @@ status_t ACodec::freeOutputBuffersNotOwnedByComponent() {
        BufferInfo *info =
            &mBuffers[kPortIndexOutput].editItemAt(i);

        if (info->mStatus !=
                BufferInfo::OWNED_BY_COMPONENT) {
            // We shouldn't have sent out any buffers to the client at this
            // point.
            CHECK_NE((int)info->mStatus, (int)BufferInfo::OWNED_BY_DOWNSTREAM);

        // At this time some buffers may still be with the component
        // or being drained.
        if (info->mStatus != BufferInfo::OWNED_BY_COMPONENT &&
            info->mStatus != BufferInfo::OWNED_BY_DOWNSTREAM) {
            CHECK_EQ((status_t)OK, freeBuffer(kPortIndexOutput, i));
        }
    }