diff options
author | Andreas Huber <andih@google.com> | 2010-08-24 14:33:58 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-08-24 14:33:58 -0700 |
commit | cce326fe43411855aca2f719e505b051bc4b61b3 (patch) | |
tree | 644689041a2ef10ed594dfe6559700d17631acdd /media/libstagefright/rtsp/APacketSource.cpp | |
parent | a1b232493d76bdf5e56fc5aae2a45691d6774369 (diff) | |
download | frameworks_av-cce326fe43411855aca2f719e505b051bc4b61b3.zip frameworks_av-cce326fe43411855aca2f719e505b051bc4b61b3.tar.gz frameworks_av-cce326fe43411855aca2f719e505b051bc4b61b3.tar.bz2 |
A first shot at proper support for seeking of rtsp streams.
Change-Id: I9604f2d09feedc0074c0e715be58e719d4483760
related-to-bug: 2556656
Diffstat (limited to 'media/libstagefright/rtsp/APacketSource.cpp')
-rw-r--r-- | media/libstagefright/rtsp/APacketSource.cpp | 52 |
1 files changed, 3 insertions, 49 deletions
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp index 8c56cb7..b930184 100644 --- a/media/libstagefright/rtsp/APacketSource.cpp +++ b/media/libstagefright/rtsp/APacketSource.cpp @@ -406,9 +406,7 @@ APacketSource::APacketSource( const sp<ASessionDescription> &sessionDesc, size_t index) : mInitCheck(NO_INIT), mFormat(new MetaData), - mEOSResult(OK), - mFirstAccessUnit(true), - mFirstAccessUnitNTP(0) { + mEOSResult(OK) { unsigned long PT; AString desc; AString params; @@ -550,9 +548,6 @@ status_t APacketSource::initCheck() const { } status_t APacketSource::start(MetaData *params) { - mFirstAccessUnit = true; - mFirstAccessUnitNTP = 0; - return OK; } @@ -600,25 +595,6 @@ void APacketSource::queueAccessUnit(const sp<ABuffer> &buffer) { return; } - uint64_t ntpTime; - CHECK(buffer->meta()->findInt64( - "ntp-time", (int64_t *)&ntpTime)); - - if (mFirstAccessUnit) { - mFirstAccessUnit = false; - mFirstAccessUnitNTP = ntpTime; - } - - if (ntpTime > mFirstAccessUnitNTP) { - ntpTime -= mFirstAccessUnitNTP; - } else { - ntpTime = 0; - } - - int64_t timeUs = (int64_t)(ntpTime * 1E6 / (1ll << 32)); - - buffer->meta()->setInt64("timeUs", timeUs); - Mutex::Autolock autoLock(mLock); mBuffers.push_back(buffer); mCondition.signal(); @@ -632,31 +608,9 @@ void APacketSource::signalEOS(status_t result) { mCondition.signal(); } -int64_t APacketSource::getQueuedDuration(bool *eos) { +void APacketSource::flushQueue() { Mutex::Autolock autoLock(mLock); - - *eos = (mEOSResult != OK); - - if (mBuffers.empty()) { - return 0; - } - - sp<ABuffer> buffer = *mBuffers.begin(); - - uint64_t ntpTime; - CHECK(buffer->meta()->findInt64( - "ntp-time", (int64_t *)&ntpTime)); - - int64_t firstTimeUs = (int64_t)(ntpTime * 1E6 / (1ll << 32)); - - buffer = *--mBuffers.end(); - - CHECK(buffer->meta()->findInt64( - "ntp-time", (int64_t *)&ntpTime)); - - int64_t lastTimeUs = (int64_t)(ntpTime * 1E6 / (1ll << 32)); - - return lastTimeUs - firstTimeUs; + mBuffers.clear(); } } // namespace android |