Home | History | Annotate | Download | only in audioflinger

Lines Matching refs:thread

77 // allow less retry attempts on direct output thread.
92 // minimum sleep time for the mixer thread loop when tracks are active but in underrun
94 // maximum divider applied to the active sleep time in the mixer thread loop
405 PlaybackThread *thread = checkPlaybackThread_l(output);
407 if (thread == NULL) {
408 LOGE("unknown output thread");
449 track = thread->createTrack_l(client, streamType, sampleRate, format,
452 // move effect chain to this output thread if an effect on same session was waiting
455 Mutex::Autolock _dl(thread->mLock);
457 moveEffectChain_l(lSessionId, effectThread, thread, true);
479 PlaybackThread *thread = checkPlaybackThread_l(output);
480 if (thread == NULL) {
481 LOGW("sampleRate() unknown thread %d", output);
484 return thread->sampleRate();
490 PlaybackThread *thread = checkPlaybackThread_l(output);
491 if (thread == NULL) {
492 LOGW("channelCount() unknown thread %d", output);
495 return thread->channelCount();
501 PlaybackThread *thread = checkPlaybackThread_l(output);
502 if (thread == NULL) {
503 LOGW("format() unknown thread %d", output);
506 return thread->format();
512 PlaybackThread *thread = checkPlaybackThread_l(output);
513 if (thread == NULL) {
514 LOGW("frameCount() unknown thread %d", output);
517 return thread->frameCount();
523 PlaybackThread *thread = checkPlaybackThread_l(output);
524 if (thread == NULL) {
525 LOGW("latency() unknown thread %d", output);
528 return thread->latency();
664 PlaybackThread *thread = NULL;
666 thread = checkPlaybackThread_l(output);
667 if (thread == NULL) {
674 if (thread == NULL) {
679 thread->setStreamVolume(stream, value);
714 PlaybackThread *thread = checkPlaybackThread_l(output);
715 if (thread == NULL) {
718 volume = thread->streamVolume(stream);
765 sp<RecordThread> thread = mRecordThreads.valueAt(i);
766 RecordThread::RecordTrack *track = thread->track();
769 thread->device() & AUDIO_DEVICE_IN_ALL);
771 thread->setEffectSuspended(FX_IID_AEC,
774 thread->setEffectSuspended(FX_IID_NS,
785 // hold a strong ref on thread in case closeOutput() or closeInput() is called
786 // and the thread is exited once the lock is released
787 sp<ThreadBase> thread;
790 thread = checkPlaybackThread_l(ioHandle);
791 if (thread == NULL) {
792 thread = checkRecordThread_l(ioHandle);
793 } else if (thread.get() == primaryPlaybackThread_l()) {
804 if (thread != NULL) {
805 result = thread->setParameters(keyValuePairs);
980 : Thread(false),
1045 // wait condition with timeout in case the thread loop has exited
1100 snprintf(buffer, SIZE, "thread %p maybe dead locked\n", this);
1177 LOGW("Thread %s cannot connect to the power manager service", mName);
1221 sp<ThreadBase> thread = mThread.promote();
1222 if (thread != 0) {
1223 thread->clearPowerManager();
1406 snprintf(buffer, SIZE, "Output thread %p tracks\n", this);
1417 snprintf(buffer, SIZE, "Output thread %p active tracks\n", this);
1440 snprintf(buffer, SIZE, "\nOutput thread %p internals\n", this);
1461 // Thread virtuals
1466 LOGI("AudioFlinger's thread %p ready to run", this);
1553 // invalidate track immediately if the stream type was moved to another thread since
1556 LOGW("createTrack_l() on thread %p: invalidating track on stream %d",
1695 LOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
1810 // this method must always be called either with ThreadBase mLock held or inside the thread loop
2033 LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
2120 //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
2226 //LOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
2238 LOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
2297 LOGV ("PlaybackThread::setStreamValid() thread %p, streamType %d, valid %d",
2416 // wait for condition with time out in case the thread calling ThreadBase::setParameters()
2892 // wait for condition with time out in case the thread calling ThreadBase::setParameters()
3102 void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread)
3104 int frameCount = (3 * mFrameCount * mSampleRate) / thread->sampleRate();
3105 OutputTrack *outputTrack = new OutputTrack((ThreadBase *)thread,
3112 thread->setStreamVolume(AUDIO_STREAM_CNT, 1.0f);
3114 LOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
3119 void AudioFlinger::DuplicatingThread::removeOutputTrack(MixerThread *thread)
3123 if (mOutputTracks[i]->thread() == (ThreadBase *)thread) {
3130 LOGV("removeOutputTrack(): unkonwn thread: %p", thread);
3137 sp<ThreadBase> strong = mOutputTracks[i]->thread().promote();
3151 sp <ThreadBase> thread = outputTracks[i]->thread().promote();
3152 if (thread == 0) {
3153 LOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
3156 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3158 LOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
3174 const wp<ThreadBase>& thread,
3184 mThread(thread),
3335 const wp<ThreadBase>& thread,
3344 : TrackBase(thread, client, sampleRate, format, channelMask, frameCount, 0, sharedBuffer, sessionId),
3349 sp<ThreadBase> baseThread = thread.promote();
3355 LOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3371 sp<ThreadBase> thread = mThread.promote();
3372 if (thread != 0) {
3373 Mutex::Autolock _l(thread->mLock);
3390 sp<ThreadBase> thread = mThread.promote();
3391 if (thread != 0) {
3394 AudioSystem::stopOutput(thread->id(),
3401 AudioSystem::releaseOutput(thread->id());
3403 Mutex::Autolock _l(thread->mLock);
3404 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3469 LOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
3488 LOGV("start(%d), calling thread %d session %d",
3490 sp<ThreadBase> thread = mThread.promote();
3491 if (thread != 0) {
3492 Mutex::Autolock _l(thread->mLock);
3498 LOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
3501 LOGV("? => ACTIVE (%d) on thread %p", mName, this);
3505 thread->mLock.unlock();
3506 status = AudioSystem::startOutput(thread->id(),
3509 thread->mLock.lock();
3517 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3530 LOGV("stop(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3531 sp<ThreadBase> thread = mThread.promote();
3532 if (thread != 0) {
3533 Mutex::Autolock _l(thread->mLock);
3538 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3542 LOGV("(> STOPPED) => STOPPED (%d) on thread %p", mName, playbackThread);
3545 thread->mLock.unlock();
3546 AudioSystem::stopOutput(thread->id(),
3549 thread->mLock.lock();
3559 LOGV("pause(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3560 sp<ThreadBase> thread = mThread.promote();
3561 if (thread != 0) {
3562 Mutex::Autolock _l(thread->mLock);
3565 LOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
3567 thread->mLock.unlock();
3568 AudioSystem::stopOutput(thread->id(),
3571 thread->mLock.lock();
3583 sp<ThreadBase> thread = mThread.promote();
3584 if (thread != 0) {
3585 Mutex::Autolock _l(thread->mLock);
3595 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3605 // the audioflinger thread detects the track is stopped.
3631 sp<ThreadBase> thread = mThread.promote();
3632 if (thread != 0) {
3633 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3649 const wp<ThreadBase>& thread,
3657 : TrackBase(thread, client, sampleRate, format,
3675 sp<ThreadBase> thread = mThread.promote();
3676 if (thread != 0) {
3677 AudioSystem::releaseInput(thread->id());
3722 sp<ThreadBase> thread = mThread.promote();
3723 if (thread != 0) {
3724 RecordThread *recordThread = (RecordThread *)thread.get();
3733 sp<ThreadBase> thread = mThread.promote();
3734 if (thread != 0) {
3735 RecordThread *recordThread = (RecordThread *)thread.get();
3762 const wp<ThreadBase>& thread,
3768 : Track(thread, NULL, AUDIO_STREAM_CNT, sampleRate, format, channelMask, frameCount, NULL, 0),
3772 PlaybackThread *playbackThread = (PlaybackThread *)thread.unsafe_get();
3784 LOGW("Error creating output track on thread %p", playbackThread);
3826 sp<ThreadBase> thread = mThread.promote();
3827 if (thread != 0) {
3828 MixerThread *mixerThread = (MixerThread *)thread.get();
3861 LOGV ("OutputTrack::write() %p thread %p no more output buffers", this, mThread.unsafe_get());
3886 LOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
3895 sp<ThreadBase> thread = mThread.promote();
3896 if (thread != 0 && !thread->standby()) {
3904 LOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
3906 LOGW("OutputTrack::write() %p thread %p no more overflow buffers", mThread.unsafe_get(), this);
4051 // will be freed from the main thread once all pending buffers have
4114 RecordThread *thread;
4127 thread = checkRecordThread_l(input);
4128 if (thread == NULL) {
4151 recordTrack = thread->createRecordTrack_l(client,
4521 // signal thread to start
4522 LOGV("Signal record thread");
4574 snprintf(buffer, SIZE, "\nInput thread %p internals\n", this);
4735 // wait for condition with time out in case the thread calling ThreadBase::setParameters()
4865 // this method must always be called either with ThreadBase mLock held or inside the thread loop
4885 PlaybackThread *thread = NULL;
4928 thread = new DirectOutputThread(this, output, id, *pDevices);
4929 LOGV("openOutput() created direct output: ID %d thread %p", id, thread);
4931 thread = new MixerThread(this, output, id, *pDevices);
4932 LOGV("openOutput() created mixer output: ID %d thread %p", id, thread);
4934 mPlaybackThreads.add(id, thread);
4939 if (pLatencyMs) *pLatencyMs = thread->latency();
4942 thread->audioConfigChanged_l(AudioSystem::OUTPUT_OPENED);
4961 DuplicatingThread *thread = new DuplicatingThread(this, thread1, id);
4962 thread->addOutputTrack(thread2);
4963 mPlaybackThreads.add(id, thread);
4965 thread->audioConfigChanged_l(AudioSystem::OUTPUT_OPENED);
4971 // keep strong reference on the playback thread so that
4973 sp <PlaybackThread> thread;
4976 thread = checkPlaybackThread_l(output);
4977 if (thread == NULL) {
4983 if (thread->type() == ThreadBase::MIXER) {
4987 dupThread->removeOutputTrack((MixerThread *)thread.get());
4995 thread->exit();
4997 if (thread->type() != ThreadBase::DUPLICATING) {
4998 AudioStreamOut *out = thread->clearOutput();
4999 // from now on thread->mOutput is NULL
5009 PlaybackThread *thread = checkPlaybackThread_l(output);
5011 if (thread == NULL) {
5016 thread->suspend();
5024 PlaybackThread *thread = checkPlaybackThread_l(output);
5026 if (thread == NULL) {
5032 thread->restore();
5044 RecordThread *thread = NULL;
5094 // Start record thread
5098 thread = new RecordThread(this,
5104 mRecordThreads.add(id, thread);
5105 LOGV("openInput() created record thread: ID %d thread %p", id, thread);
5113 thread->audioConfigChanged_l(AudioSystem::INPUT_OPENED);
5122 // keep strong reference on the record thread so that
5124 sp <RecordThread> thread;
5127 thread = checkRecordThread_l(input);
5128 if (thread == NULL) {
5137 thread->exit();
5139 AudioStreamIn *in = thread->clearInput();
5140 // from now on thread->mInput is NULL
5162 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
5163 if (thread != dstThread &&
5164 thread->type() != ThreadBase::DIRECT) {
5165 MixerThread *srcThread = (MixerThread *)thread;
5291 PlaybackThread *thread = NULL;
5293 thread = (PlaybackThread *)mPlaybackThreads.valueFor(output).get();
5295 return thread;
5301 PlaybackThread *thread = checkPlaybackThread_l(output);
5302 if (thread != NULL) {
5303 if (thread->type() == ThreadBase::DIRECT) {
5304 thread = NULL;
5307 return (MixerThread *)thread;
5313 RecordThread *thread = NULL;
5315 thread = (RecordThread *)mRecordThreads.valueFor(input).get();
5317 return thread;
5328 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
5329 AudioStreamOut *output = thread->getOutput();
5331 return thread;
5339 PlaybackThread *thread = primaryPlaybackThread_l();
5341 if (thread == NULL) {
5345 return thread->device();
5507 // look for the thread where the specified audio session is present
5522 // If no output thread contains the requested session ID, default to
5524 // thread when a track with the same session ID is created
5530 ThreadBase *thread = checkRecordThread_l(io);
5531 if (thread == NULL) {
5532 thread = checkPlaybackThread_l(io);
5533 if (thread == NULL) {
5534 LOGE("createEffect() unknown output thread");
5549 // create effect on selected output thread
5550 handle = thread->createEffect_l(client, effectClient, priority, sessionId,
5597 LOGV("moveEffectChain_l() session %d from thread %p to thread %p",
5602 LOGW("moveEffectChain_l() effect chain for session %d not on source thread %p",
5607 // remove chain first. This is useful only if reconfiguring effect chain on same output thread,
5613 // transfer all effects one by one so that new effect chain is created on new thread with
5691 LOGW("createEffect_l() effect %s (flags %08x) created on wrong thread type %d",
5697 LOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
5904 LOGV("addEffectChain_l() %p on thread %p for session %d", chain.get(), this, session);
5906 // Only one effect chain can be present in direct output thread and it uses
5964 LOGV("removeEffectChain_l() %p from thread %p for session %d", chain.get(), this, session);
6036 // only one chain per input thread
6040 LOGV("addEffectChain_l() %p on thread %p", chain.get(), this);
6054 LOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
6056 "removeEffectChain_l() %p invalid chain size %d on thread %p",
6081 sp<ThreadBase> thread = mThread.promote();
6082 if (thread == 0) {
6089 mStatus = EffectCreate(&desc->uuid, sessionId, thread->id(), &mEffectInterface);
6117 sp<ThreadBase> thread = mThread.promote();
6118 if (thread != 0) {
6119 audio_stream_t *stream = thread->stream();
6218 sp<ThreadBase> thread = mThread.promote();
6219 if (thread != 0) {
6220 thread->disconnectEffect(keep, handle, unpiniflast);
6325 sp<ThreadBase> thread = mThread.promote();
6326 if (thread == 0) {
6331 if (thread->channelCount() == 1) {
6345 mConfig.inputCfg.samplingRate = thread->sampleRate();
6370 mConfig.inputCfg.buffer.frameCount = thread->frameCount();
6373 LOGV("configure() %p thread %p buffer %p framecount %d",
6374 this, thread.get(), mConfig.inputCfg.buffer.raw, mConfig.inputCfg.buffer.frameCount);
6439 sp<ThreadBase> thread = mThread.promote();
6440 if (thread != 0) {
6441 audio_stream_t *stream = thread->stream();
6475 sp<ThreadBase> thread = mThread.promote();
6476 if (thread != 0) {
6477 audio_stream_t *stream = thread->stream();
6841 sp<ThreadBase> thread = mEffect->thread().promote();
6842 if (thread != 0) {
6843 thread->checkSuspendOnEffectEnabled(mEffect, true, mEffect->sessionId());
6853 if (thread != 0) {
6854 thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
6878 sp<ThreadBase> thread = mEffect->thread().promote();
6879 if (thread != 0) {
6880 thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
6900 sp<ThreadBase> thread = mEffect->thread().promote();
6901 if (thread != 0) {
6902 thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
6936 // No need to trylock() here as this function is executed in the binder thread serving a particular client process:
7065 sp<ThreadBase> thread = mThread.promote();
7066 if (thread == 0) {
7069 mMaxTailBuffers = ((kProcessTailDurationMs * thread->sampleRate()) / 1000) /
7070 thread->frameCount();
7131 thread = mThread.promote();
7132 if (thread == 0) {
7133 LOGW("process_l(): cannot promote mixer thread");
7152 size_t numSamples = thread->frameCount() * thread->channelCount();
7180 sp<ThreadBase> thread = mThread.promote();
7181 if (thread == 0) {
7184 effect->setThread(thread);
7195 size_t numSamples = thread->frameCount();