diff options
author | Chong Zhang <chz@google.com> | 2015-08-12 16:32:00 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-08-13 16:53:05 +0000 |
commit | fa4303dcbeac79452f35c078c8008f5c2e7622b7 (patch) | |
tree | f4fe78f77a587c26b3a618905a1ff7233a12dc96 /media/libstagefright/AudioSource.cpp | |
parent | 45d31391e6922dee2bbf9f6745f0a5545858eb63 (diff) | |
download | frameworks_av-fa4303dcbeac79452f35c078c8008f5c2e7622b7.zip frameworks_av-fa4303dcbeac79452f35c078c8008f5c2e7622b7.tar.gz frameworks_av-fa4303dcbeac79452f35c078c8008f5c2e7622b7.tar.bz2 |
adjust audio timestamp to account for AudioRecord latency
bug: 22953017
Change-Id: Iccd1bb406ff68aa8bc3ccec35c8128625894f6ae
Diffstat (limited to 'media/libstagefright/AudioSource.cpp')
-rw-r--r-- | media/libstagefright/AudioSource.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index 3505844..6e4a1dd 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -290,6 +290,10 @@ void AudioSource::signalBufferReturned(MediaBuffer *buffer) { status_t AudioSource::dataCallback(const AudioRecord::Buffer& audioBuffer) { int64_t timeUs = systemTime() / 1000ll; + // Estimate the real sampling time of the 1st sample in this buffer + // from AudioRecord's latency. (Apply this adjustment first so that + // the start time logic is not affected.) + timeUs -= mRecord->latency() * 1000LL; ALOGV("dataCallbackTimestamp: %" PRId64 " us", timeUs); Mutex::Autolock autoLock(mLock); |