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

Commit 050ec9ec authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "stagefright: add nullptr check in MediaCodecSource" am: 11d6c4cf am: dd5a2f0f

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1662900

Change-Id: I551c14e4a34f1546c70c6f53cc8a0423786042ae
parents b0af0052 dd5a2f0f
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -705,6 +705,9 @@ void MediaCodecSource::resume(int64_t resumeStartTimeUs) {
status_t MediaCodecSource::feedEncoderInputBuffers() {
status_t MediaCodecSource::feedEncoderInputBuffers() {
    MediaBufferBase* mbuf = NULL;
    MediaBufferBase* mbuf = NULL;
    while (!mAvailEncoderInputIndices.empty() && mPuller->readBuffer(&mbuf)) {
    while (!mAvailEncoderInputIndices.empty() && mPuller->readBuffer(&mbuf)) {
        if (!mEncoder) {
            return BAD_VALUE;
        }
        size_t bufferIndex = *mAvailEncoderInputIndices.begin();
        size_t bufferIndex = *mAvailEncoderInputIndices.begin();
        mAvailEncoderInputIndices.erase(mAvailEncoderInputIndices.begin());
        mAvailEncoderInputIndices.erase(mAvailEncoderInputIndices.begin());


@@ -1133,7 +1136,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {
        if (mFlags & FLAG_USE_SURFACE_INPUT) {
        if (mFlags & FLAG_USE_SURFACE_INPUT) {
            sp<AMessage> params = new AMessage;
            sp<AMessage> params = new AMessage;
            params->setInt64(PARAMETER_KEY_OFFSET_TIME, mInputBufferTimeOffsetUs);
            params->setInt64(PARAMETER_KEY_OFFSET_TIME, mInputBufferTimeOffsetUs);
            err = mEncoder->setParameters(params);
            err = mEncoder ? mEncoder->setParameters(params) : BAD_VALUE;
        }
        }


        sp<AMessage> response = new AMessage;
        sp<AMessage> response = new AMessage;
@@ -1153,7 +1156,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) {
        if (mFlags & FLAG_USE_SURFACE_INPUT) {
        if (mFlags & FLAG_USE_SURFACE_INPUT) {
            sp<AMessage> params = new AMessage;
            sp<AMessage> params = new AMessage;
            params->setInt64("stop-time-us", stopTimeUs);
            params->setInt64("stop-time-us", stopTimeUs);
            err = mEncoder->setParameters(params);
            err = mEncoder ? mEncoder->setParameters(params) : BAD_VALUE;
        } else {
        } else {
            err = mPuller->setStopTimeUs(stopTimeUs);
            err = mPuller->setStopTimeUs(stopTimeUs);
        }
        }