summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioSource.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-06-10 12:28:15 -0700
committerJames Dong <jdong@google.com>2010-06-11 13:48:48 -0700
commit08c7473ce9b601e170fd79c530f106bf74277a0f (patch)
tree927414b38c952d56b90dee681efd48060747add1 /media/libstagefright/AudioSource.cpp
parente577e87a2d80890190f14edc4a5caf70d7c566bf (diff)
downloadframeworks_base-08c7473ce9b601e170fd79c530f106bf74277a0f.zip
frameworks_base-08c7473ce9b601e170fd79c530f106bf74277a0f.tar.gz
frameworks_base-08c7473ce9b601e170fd79c530f106bf74277a0f.tar.bz2
Initial checkin for pause and resume control
Change-Id: Ibdcf7bea5fb66baa81878704ba4091dfcfe382ee
Diffstat (limited to 'media/libstagefright/AudioSource.cpp')
-rw-r--r--media/libstagefright/AudioSource.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 326e8dc..9717aa6 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -121,11 +121,13 @@ status_t AudioSource::read(
uint32_t numFramesRecorded;
mRecord->getPosition(&numFramesRecorded);
+ int64_t latency = mRecord->latency() * 1000;
+ uint32_t sampleRate = mRecord->getSampleRate();
+ int64_t timestampUs = (1000000LL * numFramesRecorded) / sampleRate - latency;
+ LOGV("latency: %lld, sample rate: %d, timestamp: %lld",
+ latency, sampleRate, timestampUs);
- buffer->meta_data()->setInt64(
- kKeyTime,
- (1000000ll * numFramesRecorded) / mRecord->getSampleRate()
- - mRecord->latency() * 1000);
+ buffer->meta_data()->setInt64(kKeyTime, timestampUs);
ssize_t n = 0;
if (mCollectStats) {