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

Commit 24d9928c authored by Lajos Molnar's avatar Lajos Molnar Committed by The Android Automerger
Browse files

stagefright: use uniqueId to detect same surface for setSurface

Bug: 29422927
Change-Id: I8b0105f87ca7e8ee745c60ab726b1dffbbd4aa87
parent f986642c
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -2682,9 +2682,12 @@ ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) {
status_t MediaCodec::connectToSurface(const sp<Surface> &surface) {
status_t MediaCodec::connectToSurface(const sp<Surface> &surface) {
    status_t err = OK;
    status_t err = OK;
    if (surface != NULL) {
    if (surface != NULL) {
        uint64_t oldId, newId;
        if (mSurface != NULL
        if (mSurface != NULL
                && surface->getConsumerName() == mSurface->getConsumerName()) {
                && surface->getUniqueId(&newId) == NO_ERROR
            ALOGI("connecting to native window with same name. Assuming no change of surface");
                && mSurface->getUniqueId(&oldId) == NO_ERROR
                && newId == oldId) {
            ALOGI("[%s] connecting to the same surface. Nothing to do.", mComponentName.c_str());
            return ALREADY_EXISTS;
            return ALREADY_EXISTS;
        }
        }