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

Commit ecc6049e authored by Wei Jia's avatar Wei Jia Committed by Android (Google) Code Review
Browse files

Merge "stagefright: use uniqueId to detect same surface for setSurface" into nyc-dev

parents 45edc1f7 b9fa58af
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;
        }
        }