Loading cmds/stagefright/SineSource.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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; Loading cmds/stagefright/stagefright.cpp +4 −6 Original line number Diff line number Diff line Loading @@ -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, ×tampUs)); bool failed = false; if (seekTimeUs >= 0) { int64_t diff = timestamp - seekTimeUs; int64_t diff = timestampUs - seekTimeUs; if (diff > 500000) { printf("ERROR: "); Loading @@ -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; Loading include/media/stagefright/MetaData.h +11 −8 Original line number Diff line number Diff line Loading @@ -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', }; Loading @@ -62,6 +62,7 @@ public: TYPE_NONE = 'none', TYPE_C_STRING = 'cstr', TYPE_INT32 = 'in32', TYPE_INT64 = 'in64', TYPE_FLOAT = 'floa', TYPE_POINTER = 'ptr ', }; Loading @@ -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); Loading media/libstagefright/AMRExtractor.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -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 Loading media/libstagefright/AudioPlayer.cpp +2 −8 Original line number Diff line number Diff line Loading @@ -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 Loading
cmds/stagefright/SineSource.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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; Loading
cmds/stagefright/stagefright.cpp +4 −6 Original line number Diff line number Diff line Loading @@ -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, ×tampUs)); bool failed = false; if (seekTimeUs >= 0) { int64_t diff = timestamp - seekTimeUs; int64_t diff = timestampUs - seekTimeUs; if (diff > 500000) { printf("ERROR: "); Loading @@ -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; Loading
include/media/stagefright/MetaData.h +11 −8 Original line number Diff line number Diff line Loading @@ -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', }; Loading @@ -62,6 +62,7 @@ public: TYPE_NONE = 'none', TYPE_C_STRING = 'cstr', TYPE_INT32 = 'in32', TYPE_INT64 = 'in64', TYPE_FLOAT = 'floa', TYPE_POINTER = 'ptr ', }; Loading @@ -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); Loading
media/libstagefright/AMRExtractor.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -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 Loading
media/libstagefright/AudioPlayer.cpp +2 −8 Original line number Diff line number Diff line Loading @@ -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