Lines Matching refs:Thread
77 // allow less retry attempts on direct output thread.
399 PlaybackThread *thread = checkPlaybackThread_l(output);
401 if (thread == NULL) {
402 LOGE("unknown output thread");
443 track = thread->createTrack_l(client, streamType, sampleRate, format,
446 // move effect chain to this output thread if an effect on same session was waiting
449 Mutex::Autolock _dl(thread->mLock);
451 moveEffectChain_l(lSessionId, effectThread, thread, true);
473 PlaybackThread *thread = checkPlaybackThread_l(output);
474 if (thread == NULL) {
475 LOGW("sampleRate() unknown thread %d", output);
478 return thread->sampleRate();
484 PlaybackThread *thread = checkPlaybackThread_l(output);
485 if (thread == NULL) {
486 LOGW("channelCount() unknown thread %d", output);
489 return thread->channelCount();
495 PlaybackThread *thread = checkPlaybackThread_l(output);
496 if (thread == NULL) {
497 LOGW("format() unknown thread %d", output);
500 return thread->format();
506 PlaybackThread *thread = checkPlaybackThread_l(output);
507 if (thread == NULL) {
508 LOGW("frameCount() unknown thread %d", output);
511 return thread->frameCount();
517 PlaybackThread *thread = checkPlaybackThread_l(output);
518 if (thread == NULL) {
519 LOGW("latency() unknown thread %d", output);
522 return thread->latency();
658 PlaybackThread *thread = NULL;
660 thread = checkPlaybackThread_l(output);
661 if (thread == NULL) {
668 if (thread == NULL) {
673 thread->setStreamVolume(stream, value);
708 PlaybackThread *thread = checkPlaybackThread_l(output);
709 if (thread == NULL) {
712 volume = thread->streamVolume(stream);
759 sp<RecordThread> thread = mRecordThreads.valueAt(i);
760 RecordThread::RecordTrack *track = thread->track();
763 thread->device() & AUDIO_DEVICE_IN_ALL);
765 thread->setEffectSuspended(FX_IID_AEC,
768 thread->setEffectSuspended(FX_IID_NS,
779 // hold a strong ref on thread in case closeOutput() or closeInput() is called
780 // and the thread is exited once the lock is released
781 sp<ThreadBase> thread;
784 thread = checkPlaybackThread_l(ioHandle);
785 if (thread == NULL) {
786 thread = checkRecordThread_l(ioHandle);
787 } else if (thread.get() == primaryPlaybackThread_l()) {
798 if (thread != NULL) {
799 result = thread->setParameters(keyValuePairs);
974 : Thread(false),
1039 // wait condition with timeout in case the thread loop has exited
1094 snprintf(buffer, SIZE, "thread %p maybe dead locked\n", this);
1171 LOGW("Thread %s cannot connect to the power manager service", mName);
1215 sp<ThreadBase> thread = mThread.promote();
1216 if (thread != 0) {
1217 thread->clearPowerManager();
1400 snprintf(buffer, SIZE, "Output thread %p tracks\n", this);
1411 snprintf(buffer, SIZE, "Output thread %p active tracks\n", this);
1434 snprintf(buffer, SIZE, "\nOutput thread %p internals\n", this);
1455 // Thread virtuals
1460 LOGI("AudioFlinger's thread %p ready to run", this);
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",
1689 LOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
1804 // this method must always be called either with ThreadBase mLock held or inside the thread loop
1999 LOGW("write blocked for %llu msecs, %d delayed writes, thread %p",
2072 //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
2178 //LOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
2190 LOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
2249 LOGV ("PlaybackThread::setStreamValid() thread %p, streamType %d, valid %d",
2368 // wait for condition with time out in case the thread calling ThreadBase::setParameters()
2849 // wait for condition with time out in case the thread calling ThreadBase::setParameters()
3059 void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread)
3061 int frameCount = (3 * mFrameCount * mSampleRate) / thread->sampleRate();
3062 OutputTrack *outputTrack = new OutputTrack((ThreadBase *)thread,
3069 thread->setStreamVolume(AUDIO_STREAM_CNT, 1.0f);
3071 LOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
3076 void AudioFlinger::DuplicatingThread::removeOutputTrack(MixerThread *thread)
3080 if (mOutputTracks[i]->thread() == (ThreadBase *)thread) {
3087 LOGV("removeOutputTrack(): unkonwn thread: %p", thread);
3094 sp<ThreadBase> strong = mOutputTracks[i]->thread().promote();
3108 sp <ThreadBase> thread = outputTracks[i]->thread().promote();
3109 if (thread == 0) {
3110 LOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
3113 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3115 LOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
3131 const wp<ThreadBase>& thread,
3141 mThread(thread),
3292 const wp<ThreadBase>& thread,
3301 : TrackBase(thread, client, sampleRate, format, channelMask, frameCount, 0, sharedBuffer, sessionId),
3306 sp<ThreadBase> baseThread = thread.promote();
3312 LOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3328 sp<ThreadBase> thread = mThread.promote();
3329 if (thread != 0) {
3330 Mutex::Autolock _l(thread->mLock);
3347 sp<ThreadBase> thread = mThread.promote();
3348 if (thread != 0) {
3351 AudioSystem::stopOutput(thread->id(),
3358 AudioSystem::releaseOutput(thread->id());
3360 Mutex::Autolock _l(thread->mLock);
3361 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3426 LOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
3445 LOGV("start(%d), calling thread %d session %d",
3447 sp<ThreadBase> thread = mThread.promote();
3448 if (thread != 0) {
3449 Mutex::Autolock _l(thread->mLock);
3455 LOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
3458 LOGV("? => ACTIVE (%d) on thread %p", mName, this);
3462 thread->mLock.unlock();
3463 status = AudioSystem::startOutput(thread->id(),
3466 thread->mLock.lock();
3474 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3487 LOGV("stop(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3488 sp<ThreadBase> thread = mThread.promote();
3489 if (thread != 0) {
3490 Mutex::Autolock _l(thread->mLock);
3495 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3499 LOGV("(> STOPPED) => STOPPED (%d) on thread %p", mName, playbackThread);
3502 thread->mLock.unlock();
3503 AudioSystem::stopOutput(thread->id(),
3506 thread->mLock.lock();
3516 LOGV("pause(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
3517 sp<ThreadBase> thread = mThread.promote();
3518 if (thread != 0) {
3519 Mutex::Autolock _l(thread->mLock);
3522 LOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
3524 thread->mLock.unlock();
3525 AudioSystem::stopOutput(thread->id(),
3528 thread->mLock.lock();
3540 sp<ThreadBase> thread = mThread.promote();
3541 if (thread != 0) {
3542 Mutex::Autolock _l(thread->mLock);
3552 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3562 // the audioflinger thread detects the track is stopped.
3588 sp<ThreadBase> thread = mThread.promote();
3589 if (thread != 0) {
3590 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
3606 const wp<ThreadBase>& thread,
3614 : TrackBase(thread, client, sampleRate, format,
3632 sp<ThreadBase> thread = mThread.promote();
3633 if (thread != 0) {
3634 AudioSystem::releaseInput(thread->id());
3679 sp<ThreadBase> thread = mThread.promote();
3680 if (thread != 0) {
3681 RecordThread *recordThread = (RecordThread *)thread.get();
3690 sp<ThreadBase> thread = mThread.promote();
3691 if (thread != 0) {
3692 RecordThread *recordThread = (RecordThread *)thread.get();
3719 const wp<ThreadBase>& thread,
3725 : Track(thread, NULL, AUDIO_STREAM_CNT, sampleRate, format, channelMask, frameCount, NULL, 0),
3729 PlaybackThread *playbackThread = (PlaybackThread *)thread.unsafe_get();
3741 LOGW("Error creating output track on thread %p", playbackThread);
3783 sp<ThreadBase> thread = mThread.promote();
3784 if (thread != 0) {
3785 MixerThread *mixerThread = (MixerThread *)thread.get();
3818 LOGV ("OutputTrack::write() %p thread %p no more output buffers", this, mThread.unsafe_get());
3843 LOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
3852 sp<ThreadBase> thread = mThread.promote();
3853 if (thread != 0 && !thread->standby()) {
3861 LOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
3863 LOGW("OutputTrack::write() %p thread %p no more overflow buffers", mThread.unsafe_get(), this);
4008 // will be freed from the main thread once all pending buffers have
4071 RecordThread *thread;
4084 thread = checkRecordThread_l(input);
4085 if (thread == NULL) {
4108 recordTrack = thread->createRecordTrack_l(client,
4478 // signal thread to start
4479 LOGV("Signal record thread");
4531 snprintf(buffer, SIZE, "\nInput thread %p internals\n", this);
4692 // wait for condition with time out in case the thread calling ThreadBase::setParameters()
4822 // this method must always be called either with ThreadBase mLock held or inside the thread loop
4842 PlaybackThread *thread = NULL;
4885 thread = new DirectOutputThread(this, output, id, *pDevices);
4886 LOGV("openOutput() created direct output: ID %d thread %p", id, thread);
4888 thread = new MixerThread(this, output, id, *pDevices);
4889 LOGV("openOutput() created mixer output: ID %d thread %p", id, thread);
4891 mPlaybackThreads.add(id, thread);
4896 if (pLatencyMs) *pLatencyMs = thread->latency();
4899 thread->audioConfigChanged_l(AudioSystem::OUTPUT_OPENED);
4918 DuplicatingThread *thread = new DuplicatingThread(this, thread1, id);
4919 thread->addOutputTrack(thread2);
4920 mPlaybackThreads.add(id, thread);
4922 thread->audioConfigChanged_l(AudioSystem::OUTPUT_OPENED);
4928 // keep strong reference on the playback thread so that
4930 sp <PlaybackThread> thread;
4933 thread = checkPlaybackThread_l(output);
4934 if (thread == NULL) {
4940 if (thread->type() == ThreadBase::MIXER) {
4944 dupThread->removeOutputTrack((MixerThread *)thread.get());
4952 thread->exit();
4954 if (thread->type() != ThreadBase::DUPLICATING) {
4955 AudioStreamOut *out = thread->clearOutput();
4956 // from now on thread->mOutput is NULL
4966 PlaybackThread *thread = checkPlaybackThread_l(output);
4968 if (thread == NULL) {
4973 thread->suspend();
4981 PlaybackThread *thread = checkPlaybackThread_l(output);
4983 if (thread == NULL) {
4989 thread->restore();
5001 RecordThread *thread = NULL;
5051 // Start record thread
5055 thread = new RecordThread(this,
5061 mRecordThreads.add(id, thread);
5062 LOGV("openInput() created record thread: ID %d thread %p", id, thread);
5070 thread->audioConfigChanged_l(AudioSystem::INPUT_OPENED);
5079 // keep strong reference on the record thread so that
5081 sp <RecordThread> thread;
5084 thread = checkRecordThread_l(input);
5085 if (thread == NULL) {
5094 thread->exit();
5096 AudioStreamIn *in = thread->clearInput();
5097 // from now on thread->mInput is NULL
5119 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
5120 if (thread != dstThread &&
5121 thread->type() != ThreadBase::DIRECT) {
5122 MixerThread *srcThread = (MixerThread *)thread;
5248 PlaybackThread *thread = NULL;
5250 thread = (PlaybackThread *)mPlaybackThreads.valueFor(output).get();
5252 return thread;
5258 PlaybackThread *thread = checkPlaybackThread_l(output);
5259 if (thread != NULL) {
5260 thread->type() == ThreadBase::DIRECT) {
5261 thread = NULL;
5264 return (MixerThread *)thread;
5270 RecordThread *thread = NULL;
5272 thread = (RecordThread *)mRecordThreads.valueFor(input).get();
5274 return thread;
5285 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
5286 AudioStreamOut *output = thread->getOutput();
5288 return thread;
5296 PlaybackThread *thread = primaryPlaybackThread_l();
5298 if (thread == NULL) {
5302 return thread->device();
5464 // look for the thread where the specified audio session is present
5479 // If no output thread contains the requested session ID, default to
5481 // thread when a track with the same session ID is created
5487 ThreadBase *thread = checkRecordThread_l(io);
5488 if (thread == NULL) {
5489 thread = checkPlaybackThread_l(io);
5490 if (thread == NULL) {
5491 LOGE("createEffect() unknown output thread");
5506 // create effect on selected output thread
5507 handle = thread->createEffect_l(client, effectClient, priority, sessionId,
5554 LOGV("moveEffectChain_l() session %d from thread %p to thread %p",
5559 LOGW("moveEffectChain_l() effect chain for session %d not on source thread %p",
5564 // remove chain first. This is useful only if reconfiguring effect chain on same output thread,
5570 // transfer all effects one by one so that new effect chain is created on new thread with
5648 LOGW("createEffect_l() effect %s (flags %08x) created on wrong thread type %d",
5654 LOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
5861 LOGV("addEffectChain_l() %p on thread %p for session %d", chain.get(), this, session);
5863 // Only one effect chain can be present in direct output thread and it uses
5921 LOGV("removeEffectChain_l() %p from thread %p for session %d", chain.get(), this, session);
5993 // only one chain per input thread
5997 LOGV("addEffectChain_l() %p on thread %p", chain.get(), this);
6011 LOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
6013 "removeEffectChain_l() %p invalid chain size %d on thread %p",
6038 sp<ThreadBase> thread = mThread.promote();
6039 if (thread == 0) {
6046 mStatus = EffectCreate(&desc->uuid, sessionId, thread->id(), &mEffectInterface);
6074 sp<ThreadBase> thread = mThread.promote();
6075 if (thread != 0) {
6076 audio_stream_t *stream = thread->stream();
6175 sp<ThreadBase> thread = mThread.promote();
6176 if (thread != 0) {
6177 thread->disconnectEffect(keep, handle, unpiniflast);
6282 sp<ThreadBase> thread = mThread.promote();
6283 if (thread == 0) {
6288 if (thread->channelCount() == 1) {
6302 mConfig.inputCfg.samplingRate = thread->sampleRate();
6327 mConfig.inputCfg.buffer.frameCount = thread->frameCount();
6330 LOGV("configure() %p thread %p buffer %p framecount %d",
6331 this, thread.get(), mConfig.inputCfg.buffer.raw, mConfig.inputCfg.buffer.frameCount);
6396 sp<ThreadBase> thread = mThread.promote();
6397 if (thread != 0) {
6398 audio_stream_t *stream = thread->stream();
6432 sp<ThreadBase> thread = mThread.promote();
6433 if (thread != 0) {
6434 audio_stream_t *stream = thread->stream();
6798 sp<ThreadBase> thread = mEffect->thread().promote();
6799 if (thread != 0) {
6800 thread->checkSuspendOnEffectEnabled(mEffect, true, mEffect->sessionId());
6810 if (thread != 0) {
6811 thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
6835 sp<ThreadBase> thread = mEffect->thread().promote();
6836 if (thread != 0) {
6837 thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
6857 sp<ThreadBase> thread = mEffect->thread().promote();
6858 if (thread != 0) {
6859 thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
6893 // No need to trylock() here as this function is executed in the binder thread serving a particular client process:
7082 sp<ThreadBase> thread = mThread.promote();
7083 if (thread == 0) {
7084 LOGW("process_l(): cannot promote mixer thread");
7098 size_t numSamples = thread->frameCount() * thread->channelCount();
7122 sp<ThreadBase> thread = mThread.promote();
7123 if (thread == 0) {
7126 effect->setThread(thread);
7137 size_t numSamples = thread->frameCount();