From af5dd7753e62353411cf0daf3b513c38818e9662 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 1 Oct 2012 16:03:44 -0700 Subject: ALooper::GetNowUs() now relies on systemTime instead of gettimeofday. Change-Id: Ia31eb0940b02581327a8bf51af6df135f9ab6de3 related-to-bug: 7266324 --- media/libstagefright/AudioSource.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'media/libstagefright/AudioSource.cpp') diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index 3248dbc..861aebe 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -54,9 +54,7 @@ AudioSource::AudioSource( mSampleRate(sampleRate), mPrevSampleTimeUs(0), mNumFramesReceived(0), - mNumClientOwnedBuffers(0), - mUseLooperTime(false) { - + mNumClientOwnedBuffers(0) { ALOGV("sampleRate: %d, channelCount: %d", sampleRate, channelCount); CHECK(channelCount == 1 || channelCount == 2); @@ -102,12 +100,6 @@ status_t AudioSource::initCheck() const { return mInitCheck; } -void AudioSource::setUseLooperTime(bool useLooperTime) { - CHECK(!mStarted); - - mUseLooperTime = useLooperTime; -} - status_t AudioSource::start(MetaData *params) { Mutex::Autolock autoLock(mLock); if (mStarted) { @@ -280,8 +272,7 @@ void AudioSource::signalBufferReturned(MediaBuffer *buffer) { } status_t AudioSource::dataCallback(const AudioRecord::Buffer& audioBuffer) { - int64_t timeUs = - mUseLooperTime ? ALooper::GetNowUs() : (systemTime() / 1000ll); + int64_t timeUs = systemTime() / 1000ll; ALOGV("dataCallbackTimestamp: %lld us", timeUs); Mutex::Autolock autoLock(mLock); @@ -300,9 +291,7 @@ status_t AudioSource::dataCallback(const AudioRecord::Buffer& audioBuffer) { if (mNumFramesReceived == 0 && mPrevSampleTimeUs == 0) { mInitialReadTimeUs = timeUs; // Initial delay - if (mUseLooperTime) { - mStartTimeUs = timeUs; - } else if (mStartTimeUs > 0) { + if (mStartTimeUs > 0) { mStartTimeUs = timeUs - mStartTimeUs; } else { // Assume latency is constant. -- cgit v1.1