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

Commit 33b51b07 authored by Phil Burk's avatar Phil Burk
Browse files

mediaplayer: fix buffer aggregation when video has offloaded audio



Change conditional test so we don't accidentally do buffer aggregation
on video buffers.

Bug: 17553847
Change-Id: I746452b2e62db664315732a38f982ce7faf26212
Signed-off-by: default avatarPhil Burk <philburk@google.com>
parent cf7863ea
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1260,8 +1260,8 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {

    // Aggregate smaller buffers into a larger buffer.
    // The goal is to reduce power consumption.
    // Unfortunately this does not work with the software AAC decoder.
    bool doBufferAggregation = (audio && mOffloadAudio);;
    // Note this will not work if the decoder requires one frame per buffer.
    bool doBufferAggregation = (audio && mOffloadAudio);
    bool needMoreData = false;

    bool dropAccessUnit;
@@ -1281,7 +1281,7 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {
            return err;
        } else if (err != OK) {
            if (err == INFO_DISCONTINUITY) {
                if (mAggregateBuffer != NULL) {
                if (doBufferAggregation && (mAggregateBuffer != NULL)) {
                    // We already have some data so save this for later.
                    mPendingAudioErr = err;
                    mPendingAudioAccessUnit = accessUnit;
@@ -1404,7 +1404,7 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {
            mAggregateBuffer->setRange(0, 0); // start empty
        }

        if (mAggregateBuffer != NULL) {
        if (doBufferAggregation && (mAggregateBuffer != NULL)) {
            int64_t timeUs;
            int64_t dummy;
            bool smallTimestampValid = accessUnit->meta()->findInt64("timeUs", &timeUs);
@@ -1453,7 +1453,7 @@ status_t NuPlayer::feedDecoderInputData(bool audio, const sp<AMessage> &msg) {
        mCCDecoder->decode(accessUnit);
    }

    if (mAggregateBuffer != NULL) {
    if (doBufferAggregation && (mAggregateBuffer != NULL)) {
        ALOGV("feedDecoderInputData() reply with aggregated buffer, %zu",
                mAggregateBuffer->size());
        reply->setBuffer("buffer", mAggregateBuffer);