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

Commit 8ffa530d authored by Gopalakrishnan Nallasamy's avatar Gopalakrishnan Nallasamy
Browse files

MediaMuxer:Limit scope of lock in writeSampleData

mState is the only variable that is shared in other functions. Hence
limiting the scope of autolock for checking mState only.

Bug: 157373376

Test: atest android.media.cts.MediaMuxerTest \
            android.mediav2.cts.MuxerTest \
            android.mediav2.cts.MuxerUnitTest
Change-Id: Ic5fd2205679c806a800e5e6f97579092942f204f
parent b24d7e55
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -192,12 +192,12 @@ status_t MediaMuxer::writeSampleData(const sp<ABuffer> &buffer, size_t trackInde
            ALOGE("WriteSampleData() is called in invalid state %d", mState);
            return INVALID_OPERATION;
        }
    }

    if (trackIndex >= mTrackList.size()) {
        ALOGE("WriteSampleData() get an invalid index %zu", trackIndex);
        return -EINVAL;
    }
    }

    MediaBuffer* mediaBuffer = new MediaBuffer(buffer);