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

Commit ac9b9600 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Allocate buffers before calling start on its source in...

Merge "Allocate buffers before calling start on its source in OMXCodec::start() for encoder case" into jb-mr1-dev
parents 9cb20d4a 0dff606f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ enum {
    kKeyTrackTimeStatus   = 'tktm',  // int64_t

    kKeyNotRealTime       = 'ntrt',  // bool (int32_t)
    kKeyNumBuffers        = 'nbbf',  // int32_t

    // Ogg files can be tagged to be automatically looping...
    kKeyAutoLoop          = 'autL',  // bool (int32_t)
+17 −5
Original line number Diff line number Diff line
@@ -3623,11 +3623,6 @@ status_t OMXCodec::start(MetaData *meta) {
        }
        params->setInt64(kKeyTime, startTimeUs);
    }
    status_t err = mSource->start(params.get());

    if (err != OK) {
        return err;
    }

    mCodecSpecificDataIndex = 0;
    mInitialBufferSubmit = true;
@@ -3640,6 +3635,23 @@ status_t OMXCodec::start(MetaData *meta) {
    mFilledBuffers.clear();
    mPaused = false;

    status_t err;
    if (mIsEncoder) {
        // Calling init() before starting its source so that we can configure,
        // if supported, the source to use exactly the same number of input
        // buffers as requested by the encoder.
        if ((err = init()) != OK) {
            return err;
        }

        params->setInt32(kKeyNumBuffers, mPortBuffers[kPortIndexInput].size());
        return mSource->start(params.get());
    }

    // Decoder case
    if ((err = mSource->start(params.get())) != OK) {
        return err;
    }
    return init();
}