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
commita7d1a2dd776bf356c228785a94ba8e0ff6a2ec7f (patch)
tree5c1bfd25a405fcf485512ffb3ced827b3d2ab630 /media/libstagefright/AudioSource.cpp
parent6f5aae1bcba130d5b8092a19fca3627aa565df56 (diff)
downloadframeworks_av-a7d1a2dd776bf356c228785a94ba8e0ff6a2ec7f.zip
frameworks_av-a7d1a2dd776bf356c228785a94ba8e0ff6a2ec7f.tar.gz
frameworks_av-a7d1a2dd776bf356c228785a94ba8e0ff6a2ec7f.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) {