public:
void triggerEvents(AudioSystem::sync_event_t type);
+ void invalidate();
+ bool isInvalid() const { return mIsInvalid; }
virtual bool isTimedTrack() const { return false; }
bool isFastTrack() const { return (mFlags & IAudioFlinger::TRACK_FAST) != 0; }
virtual bool isOut() const;
volatile float mCachedVolume; // combined master volume and stream type volume;
// 'volatile' means accessed without lock or
// barrier, but is read/written atomically
+ bool mIsInvalid; // non-resettable latch, set by invalidate()
}; // end of Track
class TimedTrack : public Track {
for (size_t i = 0; i < mTracks.size(); ++i) {
sp<Track> track = mTracks[i];
- if (sessionId == track->sessionId() &&
- !(track->mCblk->flags & CBLK_INVALID)) {
+ if (sessionId == track->sessionId() && !track->isInvalid()) {
result |= TRACK_SESSION;
break;
}
}
for (size_t i = 0; i < mTracks.size(); i++) {
sp<Track> track = mTracks[i];
- if (sessionId == track->sessionId() &&
- !(track->mCblk->flags & CBLK_INVALID)) {
+ if (sessionId == track->sessionId() && !track->isInvalid()) {
return AudioSystem::getStrategyForStream(track->streamType());
}
}
for (size_t i = 0; i < size; i++) {
sp<Track> t = mTracks[i];
if (t->streamType() == streamType) {
- android_atomic_or(CBLK_INVALID, &t->mCblk->flags);
- t->mCblk->cv.signal();
+ t->invalidate();
}
}
}
mFlags(flags),
mFastIndex(-1),
mUnderrunCount(0),
- mCachedVolume(1.0)
+ mCachedVolume(1.0),
+ mIsInvalid(false)
{
if (mCblk != NULL) {
// to avoid leaking a track name, do not allocate one unless there is an mCblk
return true;
}
+void AudioFlinger::PlaybackThread::Track::invalidate()
+{
+ // FIXME should use proxy
+ android_atomic_or(CBLK_INVALID, &mCblk->flags);
+ mCblk->cv.signal();
+ mIsInvalid = true;
+}
+
// ----------------------------------------------------------------------------
sp<AudioFlinger::PlaybackThread::TimedTrack>