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

Commit ef703f60 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change I98276091 into eclair-mr2

* changes:
  Change to a int64_t usecs representation for timestamps and duration throughout stagefright.
parents 7c6770c2 fa8de752
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ status_t SineSource::read(
        x += k;
    }

    buffer->meta_data()->setInt32(kKeyTimeUnits, mPhase);
    buffer->meta_data()->setInt32(kKeyTimeScale, mSampleRate);
    buffer->meta_data()->setInt64(
            kKeyTime, ((int64_t)mPhase * 1000000) / mSampleRate);

    mPhase += numFramesPerBuffer;

+4 −6
Original line number Diff line number Diff line
@@ -76,14 +76,12 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {

                shouldSeek = true;
            } else {
                int32_t units, scale;
                CHECK(buffer->meta_data()->findInt32(kKeyTimeUnits, &units));
                CHECK(buffer->meta_data()->findInt32(kKeyTimeScale, &scale));
                int64_t timestamp = ((OMX_TICKS)units * 1000000) / scale;
                int64_t timestampUs;
                CHECK(buffer->meta_data()->findInt64(kKeyTime, &timestampUs));

                bool failed = false;
                if (seekTimeUs >= 0) {
                    int64_t diff = timestamp - seekTimeUs;
                    int64_t diff = timestampUs - seekTimeUs;

                    if (diff > 500000) {
                        printf("ERROR: ");
@@ -92,7 +90,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
                }

                printf("buffer has timestamp %lld us (%.2f secs)\n",
                       timestamp, timestamp / 1E6);
                       timestampUs, timestampUs / 1E6);

                buffer->release();
                buffer = NULL;
+11 −8
Original line number Diff line number Diff line
@@ -27,23 +27,23 @@

namespace android {

// The following keys map to int32_t data unless indicated otherwise.
enum {
    kKeyMIMEType          = 'mime',
    kKeyMIMEType          = 'mime',  // cstring
    kKeyWidth             = 'widt',
    kKeyHeight            = 'heig',
    kKeyChannelCount      = '#chn',
    kKeySampleRate        = 'srte',
    kKeyBitRate           = 'brte',
    kKeyESDS              = 'esds',
    kKeyAVCC              = 'avcc',
    kKeyTimeUnits         = '#tim',
    kKeyTimeScale         = 'scal',
    kKeyESDS              = 'esds',  // raw data
    kKeyAVCC              = 'avcc',  // raw data
    kKeyWantsNALFragments = 'NALf',
    kKeyIsSyncFrame       = 'sync',
    kKeyDuration          = 'dura',
    kKeyTime              = 'time',  // int64_t (usecs)
    kKeyDuration          = 'dura',  // int64_t (usecs)
    kKeyColorFormat       = 'colf',
    kKeyPlatformPrivate   = 'priv',
    kKeyDecoderComponent  = 'decC',
    kKeyPlatformPrivate   = 'priv',  // pointer
    kKeyDecoderComponent  = 'decC',  // cstring
    kKeyBufferID          = 'bfID',
    kKeyMaxInputSize      = 'inpS',
};
@@ -62,6 +62,7 @@ public:
        TYPE_NONE     = 'none',
        TYPE_C_STRING = 'cstr',
        TYPE_INT32    = 'in32',
        TYPE_INT64    = 'in64',
        TYPE_FLOAT    = 'floa',
        TYPE_POINTER  = 'ptr ',
    };
@@ -71,11 +72,13 @@ public:

    bool setCString(uint32_t key, const char *value);
    bool setInt32(uint32_t key, int32_t value);
    bool setInt64(uint32_t key, int64_t value);
    bool setFloat(uint32_t key, float value);
    bool setPointer(uint32_t key, void *value);

    bool findCString(uint32_t key, const char **value);
    bool findInt32(uint32_t key, int32_t *value);
    bool findInt64(uint32_t key, int64_t *value);
    bool findFloat(uint32_t key, float *value);
    bool findPointer(uint32_t key, void **value);

+1 −4
Original line number Diff line number Diff line
@@ -201,10 +201,7 @@ status_t AMRSource::read(
    }

    buffer->set_range(0, frameSize);
    buffer->meta_data()->setInt32(
            kKeyTimeUnits, (mCurrentTimeUs + 500) / 1000);
    buffer->meta_data()->setInt32(
            kKeyTimeScale, 1000);
    buffer->meta_data()->setInt64(kKeyTime, mCurrentTimeUs);

    mOffset += frameSize;
    mCurrentTimeUs += 20000;  // Each frame is 20ms
+2 −8
Original line number Diff line number Diff line
@@ -209,15 +209,9 @@ void AudioPlayer::fillBuffer(void *data, size_t size) {
                break;
            }

            int32_t units, scale;
            bool success =
                mInputBuffer->meta_data()->findInt32(kKeyTimeUnits, &units);
            success = success &&
                mInputBuffer->meta_data()->findInt32(kKeyTimeScale, &scale);
            CHECK(success);

            Mutex::Autolock autoLock(mLock);
            mPositionTimeMediaUs = (int64_t)units * 1000000 / scale;
            CHECK(mInputBuffer->meta_data()->findInt64(
                        kKeyTime, &mPositionTimeMediaUs));

            mPositionTimeRealUs =
                ((mNumFramesPlayed + size_done / mFrameSize) * 1000000)
Loading