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

Commit 90aae0de authored by Chong Zhang's avatar Chong Zhang Committed by android-build-merger
Browse files

Merge "Tuning of buffer dequeue code to reduce stalls" into pi-dev

am: e44ca376

Change-Id: I9a476ed69476aca8da4fdfdc89166ce98e9892bc
parents acf958d2 e44ca376
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -628,7 +628,7 @@ status_t MPEG4Extractor::readMetaData() {
            track->meta.setInt32(kKeyTrackID, imageIndex);
            track->includes_expensive_metadata = false;
            track->skipTrack = false;
            track->timescale = 0;
            track->timescale = 1000000;
        }
    }

+19 −22
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@

namespace android {

static const int64_t kBufferTimeOutUs = 30000ll; // 30 msec
static const size_t kRetryCount = 20; // must be >0
static const int64_t kBufferTimeOutUs = 10000ll; // 10 msec
static const size_t kRetryCount = 50; // must be >0

//static
sp<IMemory> allocVideoFrame(const sp<MetaData>& trackMeta,
@@ -269,10 +269,13 @@ status_t FrameDecoder::extractInternal(
        uint32_t flags = 0;
        sp<MediaCodecBuffer> codecBuffer = NULL;

        // Queue as many inputs as we possibly can, then block on dequeuing
        // outputs. After getting each output, come back and queue the inputs
        // again to keep the decoder busy.
        while (haveMoreInputs) {
            err = decoder->dequeueInputBuffer(&inputIndex, kBufferTimeOutUs);
            err = decoder->dequeueInputBuffer(&inputIndex, 0);
            if (err != OK) {
                ALOGW("Timed out waiting for input");
                ALOGV("Timed out waiting for input");
                if (retriesLeft) {
                    err = OK;
                }
@@ -311,8 +314,6 @@ status_t FrameDecoder::extractInternal(
            }

            mediaBuffer->release();
            break;
        }

            if (haveMoreInputs && inputIndex < inputBuffers.size()) {
                ALOGV("QueueInput: size=%zu ts=%" PRId64 " us flags=%x",
@@ -328,10 +329,6 @@ status_t FrameDecoder::extractInternal(
                if (flags & MediaCodec::BUFFER_FLAG_EOS) {
                    haveMoreInputs = false;
                }

            // we don't expect an output from codec config buffer
            if (flags & MediaCodec::BUFFER_FLAG_CODECCONFIG) {
                continue;
            }
        }