Home | History | Annotate | Download | only in audioflinger

Lines Matching refs:Track

384     sp<PlaybackThread::Track> track;
427 // check if an effect with same session ID is waiting for a track to be created
443 track = thread->createTrack_l(client, streamType, sampleRate, format,
447 // for a track to be created
455 trackHandle = new TrackHandle(track);
457 // remove local strong reference to Client before deleting the Track so that the Client
460 track.clear();
760 RecordThread::RecordTrack *track = thread->track();
761 if (track != NULL) {
767 track->sessionId());
770 track->sessionId());
1404 sp<Track> track = mTracks[i];
1405 if (track != 0) {
1406 track->dump(buffer, SIZE);
1415 wp<Track> wTrack = mActiveTracks[i];
1417 sp<Track> track = wTrack.promote();
1418 if (track != 0) {
1419 track->dump(buffer, SIZE);
1473 sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrack_l(
1484 sp<Track> track;
1521 sp<Track> t = mTracks[i];
1531 track = new Track(this, client, streamType, sampleRate, format,
1533 if (track->getCblk() == NULL || track->name() < 0) {
1537 mTracks.add(track);
1542 track->setMainBuffer(chain->inBuffer());
1543 chain->setStrategy(AudioSystem::getStrategyForStream((audio_stream_type_t)track->type()));
1547 // invalidate track immediately if the stream type was moved to another thread since
1550 LOGW("createTrack_l() on thread %p: invalidating track on stream %d",
1552 android_atomic_or(CBLK_INVALID_ON, &track->mCblk->flags);
1561 return track;
1619 status_t AudioFlinger::PlaybackThread::addTrack_l(const sp<Track>& track)
1624 track->mRetryCount = kMaxTrackStartupRetries;
1625 if (mActiveTracks.indexOf(track) < 0) {
1626 // the track is newly added, make sure it fills up all its
1629 track->mFillingUpStatus = Track::FS_FILLING;
1630 track->mResetDone = false;
1631 mActiveTracks.add(track);
1632 if (track->mainBuffer() != mMixBuffer) {
1633 sp<EffectChain> chain = getEffectChain_l(track->sessionId());
1635 LOGV("addTrack_l() starting track on chain %p for session %d", chain.get(), track->sessionId());
1650 void AudioFlinger::PlaybackThread::destroyTrack_l(const sp<Track>& track)
1652 track->mState = TrackBase::TERMINATED;
1653 if (mActiveTracks.indexOf(track) < 0) {
1654 removeTrack_l(track);
1658 void AudioFlinger::PlaybackThread::removeTrack_l(const sp<Track>& track)
1660 mTracks.remove(track);
1661 deleteTrackName_l(track->name());
1662 sp<EffectChain> chain = getEffectChain_l(track->sessionId());
1761 sp<Track> track = mTracks[i];
1762 if (sessionId == track->sessionId() &&
1763 !(track->mCblk->flags & CBLK_INVALID_MSK)) {
1780 sp<Track> track = mTracks[i];
1781 if (sessionId == track->sessionId() &&
1782 !(track->mCblk->flags & CBLK_INVALID_MSK)) {
1783 return AudioSystem::getStrategyForStream((audio_stream_type_t) track->type());
1835 Vector< sp<Track> > tracksToRemove;
1904 const SortedVector< wp<Track> >& activeTracks = mActiveTracks;
2035 uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track> >& activeTracks, Vector< sp<Track> > *tracksToRemove)
2060 sp<Track> t = activeTracks[i].promote();
2063 Track* const track = t.get();
2064 audio_track_cblk_t* cblk = track->cblk();
2066 // The first time a track is added we wait
2068 mAudioMixer->setActiveTrack(track->name());
2069 if (cblk->framesReady() && track->isReady() &&
2070 !track->isPaused() && !track->isTerminated())
2072 //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
2076 // track->mainBuffer() != mMixBuffer means there is an effect chain
2077 // connected to the track
2079 if (track->mainBuffer() != mMixBuffer) {
2080 chain = getEffectChain_l(track->sessionId());
2081 // Delegate volume control to effect in track effect chain if needed
2085 LOGW("prepareTracks_l(): track %08x attached to effect but no chain found on session %d",
2086 track->name(), track->sessionId());
2092 if (track->mFillingUpStatus == Track::FS_FILLED) {
2094 track->mFillingUpStatus = Track::FS_ACTIVE;
2095 if (track->mState == TrackBase::RESUMING) {
2096 track->mState = TrackBase::ACTIVE;
2101 // If the track is stopped before the first frame was mixed,
2106 // compute volume for this track
2108 if (track->isMuted() || track->isPausing() ||
2109 mStreamTypes[track->type()].mute) {
2111 if (track->isPausing()) {
2112 track->setPaused();
2117 float typeVolume = mStreamTypes[track->type()].volume;
2124 // Delegate volume control to effect in track effect chain if needed
2128 track->mHasVolumeController = true;
2132 if (track->mHasVolumeController) {
2135 track->mHasVolumeController = false;
2151 mAudioMixer->setBufferProvider(track);
2158 AudioMixer::TRACK,
2159 AudioMixer::FORMAT, (void *)track->format());
2161 AudioMixer::TRACK,
2162 AudioMixer::CHANNEL_MASK, (void *)track->channelMask());
2168 AudioMixer::TRACK,
2169 AudioMixer::MAIN_BUFFER, (void *)track->mainBuffer());
2171 AudioMixer::TRACK,
2172 AudioMixer::AUX_BUFFER, (void *)track->auxBuffer());
2175 track->mRetryCount = kMaxTrackRetries;
2178 //LOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
2179 if (track->isStopped()) {
2180 track->reset();
2182 if (track->isTerminated() || track->isStopped() || track->isPaused()) {
2183 // We have consumed all the buffers of this track.
2185 tracksToRemove->add(track);
2187 // No buffers for this track. Give it a few chances to
2189 if (--(track->mRetryCount) <= 0) {
2190 LOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
2191 tracksToRemove->add(track);
2192 // indicate to client process that the track was disabled because of underrun
2206 const sp<Track>& track = tracksToRemove->itemAt(i);
2207 mActiveTracks.remove(track);
2208 if (track->mainBuffer() != mMixBuffer) {
2209 chain = getEffectChain_l(track->sessionId());
2211 LOGV("stopping track on chain %p for session Id: %d", chain.get(), track->sessionId());
2215 if (track->isTerminated()) {
2216 removeTrack_l(track);
2223 // mix buffer and track effects will accumulate into it
2239 sp<Track> t = mTracks[i];
2265 LOGV("remove track (%d) and delete from mixer", name);
2298 // do not accept frame count changes if tracks are open as the track buffer
2300 // if frame count is changed after track creation
2355 // limit track sample rate to 2 x new output sample rate
2515 sp<Track> trackToRemove;
2516 sp<Track> activeTrack;
2593 sp<Track> t = mActiveTracks[0].promote();
2596 Track* const track = t.get();
2597 audio_track_cblk_t* cblk = track->cblk();
2599 // The first time a track is added we wait
2601 if (cblk->framesReady() && track->isReady() &&
2602 !track->isPaused() && !track->isTerminated())
2604 //LOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server);
2606 if (track->mFillingUpStatus == Track::FS_FILLED) {
2607 track->mFillingUpStatus = Track::FS_ACTIVE;
2610 if (track->mState == TrackBase::RESUMING) {
2611 track->mState = TrackBase::ACTIVE;
2615 // If the track is stopped before the first frame was mixed,
2619 // compute volume for this track
2621 if (track->isMuted() || mMasterMute || track->isPausing() ||
2622 mStreamTypes[track->type()].mute) {
2624 if (track->isPausing()) {
2625 track->setPaused();
2628 float typeVolume = mStreamTypes[track->type()].volume;
2653 // Delegate volume control to effect in track effect chain if needed
2655 // there is one, the track is connected to it
2677 track->mRetryCount = kMaxTrackRetriesDirect;
2681 //LOGV("track %d u=%08x, s=%08x [NOT READY]", track->name(), cblk->user, cblk->server);
2682 if (track->isStopped()) {
2683 track->reset();
2685 if (track->isTerminated() || track->isStopped() || track->isPaused()) {
2686 // We have consumed all the buffers of this track.
2688 trackToRemove = track;
2690 // No buffers for this track. Give it a few chances to
2692 if (--(track->mRetryCount) <= 0) {
2693 LOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
2694 trackToRemove = track;
2706 LOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
2776 // finally let go of removed track, without the lock held
2820 // do not accept frame count changes if tracks are open as the track buffer
2822 // if frame count is changed after track creation
2909 Vector< sp<Track> > tracksToRemove;
2938 const SortedVector< wp<Track> >& activeTracks = mActiveTracks;
3071 LOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
3110 LOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
3115 LOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
3153 // LOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
3275 // Check validity of returned pointer in case the track control block would have been corrupted.
3290 // Track constructor must be called with AudioFlinger::mLock and ThreadBase::mLock held
3291 AudioFlinger::PlaybackThread::Track::Track(
3312 LOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3314 LOGE("no more track names available");
3325 AudioFlinger::PlaybackThread::Track::~Track()
3327 LOGV("PlaybackThread::Track destructor");
3335 void AudioFlinger::PlaybackThread::Track::destroy()
3337 // NOTE: destroyTrack_l() can remove a strong reference to this Track
3340 // we must acquire a strong reference on this Track before locking mLock
3342 // On the other hand, as long as Track::destroy() is only called by
3344 // this Track with its member mTrack.
3345 sp<Track> keep(this);
3355 // to track the speaker usage
3367 void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size)
3389 status_t AudioFlinger::PlaybackThread::Track::getNextBuffer(AudioBufferProvider::Buffer* buffer)
3426 LOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
3430 bool AudioFlinger::PlaybackThread::Track::isReady() const {
3442 status_t AudioFlinger::PlaybackThread::Track::start()
3451 // here the track could be either new, or restarted
3452 // in both cases "unstop" the track
3468 // to track the speaker usage
3485 void AudioFlinger::PlaybackThread::Track::stop()
3494 // If the track is not active (PAUSED and buffers full), flush buffers
3508 // to track the speaker usage
3514 void AudioFlinger::PlaybackThread::Track::pause()
3530 // to track the speaker usage
3537 void AudioFlinger::PlaybackThread::Track::flush()
3550 // do not reset the track if it is still in the process of being stopped or paused.
3551 // this will be done by prepareTracks_l() when the track is stopped.
3559 void AudioFlinger::PlaybackThread::Track::reset()
3562 // the audioflinger thread detects the track is stopped.
3574 void AudioFlinger::PlaybackThread::Track::mute(bool muted)
3579 void AudioFlinger::PlaybackThread::Track::setVolume(float left, float right)
3585 status_t AudioFlinger::PlaybackThread::Track::attachAuxEffect(int EffectId)
3596 void AudioFlinger::PlaybackThread::Track::setAuxBuffer(int EffectId, int32_t *buffer)
3725 : Track(thread, NULL, AUDIO_STREAM_CNT, sampleRate, format, channelMask, frameCount, NULL, 0),
3741 LOGW("Error creating output track on thread %p", playbackThread);
3752 status_t status = Track::start();
3764 Track::stop();
3869 // If no more buffers are pending, fill output track buffer to make sure it is started
4000 AudioFlinger::TrackHandle::TrackHandle(const sp<AudioFlinger::PlaybackThread::Track>& track)
4002 mTrack(track)
4007 // just stop the track on deletion, associated resources
4009 // been played. Unless it's not in the active track list, in which
4107 // create new record track. The record track uses one track in mHardwareMixerThread by convention.
4411 sp<RecordTrack> track;
4423 track = new RecordTrack(this, client, sampleRate,
4426 if (track->getCblk() == NULL) {
4431 mTrack = track.get();
4444 return track;
4535 result.append("Active Track:\n");
4633 // do not accept frame count changes if tracks are open as the track buffer
4635 // if frame count is changed after track creation
4802 AudioFlinger::RecordThread::RecordTrack* AudioFlinger::RecordThread::track()
5481 // thread when a track with the same session ID is created
5875 sp<Track> track = mTracks[i];
5876 if (session == track->sessionId()) {
5877 LOGV("addEffectChain_l() track->setMainBuffer track %p buffer %p", track.get(), buffer);
5878 track->setMainBuffer(buffer);
5885 sp<Track> track = mActiveTracks[i].promote();
5886 if (track == 0) continue;
5887 if (session == track->sessionId()) {
5888 LOGV("addEffectChain_l() activating track %p on session %d", track.get(), session);
5900 // after track specific effects and before output stage
5928 sp<Track> track = mActiveTracks[i].promote();
5929 if (track == 0) continue;
5930 if (session == track->sessionId()) {
5931 LOGV("removeEffectChain_l(): stopping track on chain %p for session Id: %d",
5939 sp<Track> track = mTracks[i];
5940 if (session == track->sessionId()) {
5941 track->setMainBuffer(mMixBuffer);
5952 const sp<AudioFlinger::PlaybackThread::Track> track, int EffectId)
5955 return attachAuxEffect_l(track, EffectId);
5959 const sp<AudioFlinger::PlaybackThread::Track> track, int EffectId)
5964 track->setAuxBuffer(0, NULL);
5970 track->setAuxBuffer(EffectId, (int32_t *)effect->inBuffer());
5984 sp<Track> track = mTracks[i];
5985 if (track->auxEffectId() == effectId) {
5986 attachAuxEffect_l(track, 0);
6287 // TODO: handle configuration of effects replacing track process
7094 // if no track is active, input buffer must be cleared here as the mixer process
7103 // do not process effect if no track is present in same audio session
7146 // after track and auxiliary effects.