summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-10-01 22:38:43 +0000
committerEric Laurent <elaurent@google.com>2014-10-01 22:45:18 +0000
commit6954127b7ace022677ac407ff943c2793f8a11be (patch)
tree3e038561671d256e03d63fb88a32e529e198701a /services
parent54464ba861aaafd11ee5645f5d1ecd1171c6e9fe (diff)
downloadframeworks_av-6954127b7ace022677ac407ff943c2793f8a11be.zip
frameworks_av-6954127b7ace022677ac407ff943c2793f8a11be.tar.gz
frameworks_av-6954127b7ace022677ac407ff943c2793f8a11be.tar.bz2
Revert "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp"
This reverts commit 54464ba861aaafd11ee5645f5d1ecd1171c6e9fe. Bug: 17733142. Change-Id: I9886d40032b2f7d96bee03e600e14f78943d8052
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/Threads.cpp13
-rw-r--r--services/audioflinger/Threads.h1
-rw-r--r--services/audioflinger/Tracks.cpp10
3 files changed, 1 insertions, 23 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index fe258ae..818bb05 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2126,7 +2126,6 @@ ssize_t AudioFlinger::PlaybackThread::threadLoop_write()
size_t totalFramesWritten = mNormalSink->framesWritten();
if (totalFramesWritten >= mLatchD.mTimestamp.mPosition) {
mLatchD.mUnpresentedFrames = totalFramesWritten - mLatchD.mTimestamp.mPosition;
- // mLatchD.mFramesReleased is set in threadloop_mix()
mLatchDValid = true;
}
}
@@ -3092,18 +3091,6 @@ void AudioFlinger::MixerThread::threadLoop_mix()
sleepTime = 0;
standbyTime = systemTime() + standbyDelay;
//TODO: delay standby when effects have a tail
-
- mLatchD.mFramesReleased.clear();
- {
- Mutex::Autolock _l(mLock);
- size_t size = mActiveTracks.size();
- for (size_t i = 0; i < size; i++) {
- sp<Track> t = mActiveTracks[i].promote();
- if (t != 0) {
- mLatchD.mFramesReleased.add(t.get(), t->mAudioTrackServerProxy->framesReleased());
- }
- }
- }
}
void AudioFlinger::MixerThread::threadLoop_sleepTime()
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index cda8095..fd025b5 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -819,7 +819,6 @@ private:
struct {
AudioTimestamp mTimestamp;
uint32_t mUnpresentedFrames;
- KeyedVector<Track *, uint32_t> mFramesReleased;
} mLatchD, mLatchQ;
bool mLatchDValid; // true means mLatchD is valid, and clock it into latch at next opportunity
bool mLatchQValid; // true means mLatchQ is valid
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 8c2bee4..c0a75b9 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -894,15 +894,7 @@ status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& times
uint32_t unpresentedFrames =
((int64_t) playbackThread->mLatchQ.mUnpresentedFrames * mSampleRate) /
playbackThread->mSampleRate;
- // FIXME Since we're using a raw pointer as the key, it is theoretically possible
- // for a brand new track to share the same address as a recently destroyed
- // track, and thus for us to get the frames released of the wrong track.
- // It is unlikely that we would be able to call getTimestamp() so quickly
- // right after creating a new track. Nevertheless, the index here should
- // be changed to something that is unique. Or use a completely different strategy.
- ssize_t i = playbackThread->mLatchQ.mFramesReleased.indexOfKey(this);
- uint32_t framesWritten = i >= 0 ?
- playbackThread->mLatchQ.mFramesReleased[i] : mAudioTrackServerProxy->framesReleased();
+ uint32_t framesWritten = mAudioTrackServerProxy->framesReleased();
bool checkPreviousTimestamp = mPreviousValid && framesWritten >= mPreviousFramesWritten;
if (framesWritten < unpresentedFrames) {
mPreviousValid = false;