Home | History | Annotate | Download | only in audioflinger

Lines Matching defs:thread

332     sp<MmapThread> thread = mMmapThreads.valueFor(io);
333 if (thread != 0) {
334 interface = new MmapThreadHandle(thread);
335 thread->configure(&localAttr, streamType, actualSessionId, callback, *deviceId, portId);
560 "Historical Thread Log ", 0 /* lines */,
741 // further channel mask checks are performed by createTrack_l() depending on the thread type
748 // further format checks are performed by createTrack_l() depending on the thread type
757 PlaybackThread *thread = checkPlaybackThread_l(output.outputId);
758 if (thread == NULL) {
759 ALOGE("no playback thread found for output handle %d", output.outputId);
768 // output thread and move it here.
786 track = thread->createTrack_l(client, streamType, localAttr, &output.sampleRate,
796 output.afFrameCount = thread->frameCount();
797 output.afSampleRate = thread->sampleRate();
798 output.afLatencyMs = thread->latency();
809 ALOGE("no playback thread found for secondary output %d", output.outputId);
813 size_t frameCount = std::lcm(thread->frameCount(), secondaryThread->frameCount());
817 sp patchRecord = new RecordThread::PatchRecord(nullptr /* thread */,
833 // for fast usage: thread has fast mixer, sample rate matches, etc.;
862 // move effect chain to this output thread if an effect on same session was waiting
866 Mutex::Autolock _dl(thread->mLock);
868 if (moveEffectChain_l(sessionId, effectThread, thread) == NO_ERROR) {
869 effectThreadId = thread->id();
870 effectIds = thread->getEffectIds_l(sessionId);
877 if (thread->isValidSyncEvent(mPendingSyncEvents[i])) {
889 setAudioHwSyncForSession_l(thread, sessionId);
906 // was found on another thread and must be moved on this thread
925 ThreadBase *thread = checkThread_l(ioHandle);
926 if (thread == NULL) {
927 ALOGW("sampleRate() unknown thread %d", ioHandle);
930 return thread->sampleRate();
936 PlaybackThread *thread = checkPlaybackThread_l(output);
937 if (thread == NULL) {
938 ALOGW("format() unknown thread %d", output);
941 return thread->format();
947 ThreadBase *thread = checkThread_l(ioHandle);
948 if (thread == NULL) {
949 ALOGW("frameCount() unknown thread %d", ioHandle);
954 return thread->frameCount();
960 ThreadBase *thread = checkThread_l(ioHandle);
961 if (thread == NULL) {
962 ALOGW("frameCountHAL() unknown thread %d", ioHandle);
965 return thread->frameCountHAL();
971 PlaybackThread *thread = checkPlaybackThread_l(output);
972 if (thread == NULL) {
973 ALOGW("latency(): no playback thread found for output handle %d", output);
976 return thread->latency();
1006 // Now set the master volume in each playback thread. Playback threads
1175 // Now set the master mute in each playback thread. Playback threads
1457 // hold a strong ref on thread in case closeOutput() or closeInput() is called
1458 // and the thread is exited once the lock is released
1459 sp<ThreadBase> thread;
1462 thread = checkPlaybackThread_l(ioHandle);
1463 if (thread == 0) {
1464 thread = checkRecordThread_l(ioHandle);
1465 if (thread == 0) {
1466 thread = checkMmapThread_l(ioHandle);
1468 } else if (thread == primaryPlaybackThread_l()) {
1478 if (thread != 0) {
1479 status_t result = thread->setParameters(filteredKeyValuePairs);
1480 forwardParametersToDownstreamPatches_l(thread->id(), filteredKeyValuePairs);
1511 ThreadBase *thread = (ThreadBase *)checkPlaybackThread_l(ioHandle);
1512 if (thread == NULL) {
1513 thread = (ThreadBase *)checkRecordThread_l(ioHandle);
1514 if (thread == NULL) {
1515 thread = (ThreadBase *)checkMmapThread_l(ioHandle);
1516 if (thread == NULL) {
1521 return thread->getParameters(keys);
1715 sp<ThreadBase> thread;
1719 ALOG_ASSERT(thread == 0);
1720 thread = mPlaybackThreads.valueAt(i);
1723 if (thread != nullptr) {
1724 return thread;
1728 ALOG_ASSERT(thread == 0);
1729 thread = mRecordThreads.valueAt(i);
1732 if (thread != nullptr) {
1733 return thread;
1737 ALOG_ASSERT(thread == 0);
1738 thread = mMmapThreads.valueAt(i);
1741 return thread;
1917 RecordThread *thread = checkRecordThread_l(output.inputId);
1918 if (thread == NULL) {
1930 recordTrack = thread->createRecordTrack_l(client, input.attr, &output.sampleRate,
1950 // session and move it to this thread.
1953 Mutex::Autolock _l(thread->mLock);
1954 thread->addEffectChain_l(chain);
2087 PlaybackThread *thread = fastPlaybackThread_l();
2088 return thread != NULL ? thread->sampleRate() : 0;
2094 PlaybackThread *thread = fastPlaybackThread_l();
2095 return thread != NULL ? thread->frameCountHAL() : 0;
2210 sp<PlaybackThread> thread = mPlaybackThreads.valueAt(i);
2211 uint32_t sessions = thread->hasAudioSession(sessionId);
2216 thread->setParameters(keyValuePairs);
2217 forwardParametersToDownstreamPatches_l(thread->id(), keyValuePairs,
2218 [](const sp<PlaybackThread>& thread) { return thread->usesHwAvSync(); });
2237 ThreadBase *thread = (ThreadBase *)mPlaybackThreads.valueAt(i).get();
2238 thread->systemReady();
2241 ThreadBase *thread = (ThreadBase *)mRecordThreads.valueAt(i).get();
2242 thread->systemReady();
2256 void AudioFlinger::setAudioHwSyncForSession_l(PlaybackThread *thread, audio_session_t sessionId)
2265 thread->setParameters(keyValuePairs);
2266 forwardParametersToDownstreamPatches_l(thread->id(), keyValuePairs,
2267 [](const sp<PlaybackThread>& thread) { return thread->usesHwAvSync(); });
2332 sp<MmapPlaybackThread> thread =
2335 mMmapThreads.add(*output, thread);
2336 ALOGV("openOutput_l() created mmap playback thread: ID %d thread %p",
2337 *output, thread.get());
2338 return thread;
2340 sp<PlaybackThread> thread;
2342 thread = new OffloadThread(this, outputStream, *output, devices, mSystemReady);
2343 ALOGV("openOutput_l() created offload output: ID %d thread %p",
2344 *output, thread.get());
2348 thread = new DirectOutputThread(this, outputStream, *output, devices, mSystemReady);
2349 ALOGV("openOutput_l() created direct output: ID %d thread %p",
2350 *output, thread.get());
2352 thread = new MixerThread(this, outputStream, *output, devices, mSystemReady);
2353 ALOGV("openOutput_l() created mixer output: ID %d thread %p",
2354 *output, thread.get());
2356 mPlaybackThreads.add(*output, thread);
2358 return thread;
2388 sp<ThreadBase> thread = openOutput_l(module, output, config, *devices, address, flags);
2389 if (thread != 0) {
2391 PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
2408 MmapThread *mmapThread = (MmapThread *)thread.get();
2431 DuplicatingThread *thread = new DuplicatingThread(this, thread1, id, mSystemReady);
2432 thread->addOutputTrack(thread2);
2433 mPlaybackThreads.add(id, thread);
2435 thread->ioConfigChanged(AUDIO_OUTPUT_OPENED);
2446 // keep strong reference on the playback thread so that
2470 // save all effects to the default thread
2474 // audioflinger lock is held so order of thread lock acquisition doesn't matter
2498 // The thread entity (active unit of execution) is no longer running here,
2511 // from now on thread->mOutput is NULL
2517 void AudioFlinger::closeOutputFinish(const sp<PlaybackThread>& thread)
2519 AudioStreamOut *out = thread->clearOutput();
2521 // from now on thread->mOutput is NULL
2525 void AudioFlinger::closeThreadInternal_l(const sp<PlaybackThread>& thread)
2527 mPlaybackThreads.removeItem(thread->mId);
2528 thread->exit();
2529 closeOutputFinish(thread);
2535 PlaybackThread *thread = checkPlaybackThread_l(output);
2537 if (thread == NULL) {
2542 thread->suspend();
2550 PlaybackThread *thread = checkPlaybackThread_l(output);
2552 if (thread == NULL) {
2558 thread->restore();
2577 sp<ThreadBase> thread = openInput_l(
2580 if (thread != 0) {
2582 thread->ioConfigChanged(AUDIO_INPUT_OPENED);
2657 sp<MmapCaptureThread> thread =
2661 mMmapThreads.add(*input, thread);
2662 ALOGV("openInput_l() created mmap capture thread: ID %d thread %p", *input,
2663 thread.get());
2664 return thread;
2666 // Start record thread
2669 sp<RecordThread> thread = new RecordThread(this,
2676 mRecordThreads.add(*input, thread);
2677 ALOGV("openInput_l() created record thread: ID %d thread %p", *input, thread.get());
2678 return thread;
2693 // keep strong reference on the record thread so that
2706 // on at least one effect. We must either move the chain to an existing thread with the
2707 // same session ID or put it aside in case a new record thread is opened for a
2713 // Note: maximum one chain per record thread
2719 // first check if a record thread is already opened with a client on same session.
2720 // This should only happen in case of overlap between one thread tear down and the
2730 ALOGV("closeInput() found thread %d for effect session %d",
2736 // put the chain aside if we could not find a record thread with the same session id
2754 // FIXME: calling thread->exit() without mLock held should not be needed anymore now that
2762 // from now on thread->mInput is NULL
2768 void AudioFlinger::closeInputFinish(const sp<RecordThread>& thread)
2770 thread->exit();
2771 AudioStreamIn *in = thread->clearInput();
2773 // from now on thread->mInput is NULL
2777 void AudioFlinger::closeThreadInternal_l(const sp<RecordThread>& thread)
2779 mRecordThreads.removeItem(thread->mId);
2780 closeInputFinish(thread);
2789 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
2790 thread->invalidateTracks(stream);
2967 void AudioFlinger::dumpToThreadLog_l(const sp<ThreadBase> &thread)
2972 thread->dump(fd, {} /* args */);
2980 ThreadBase *thread = checkMmapThread_l(ioHandle);
2981 if (thread == 0) {
2984 thread = checkPlaybackThread_l(ioHandle);
2987 thread = checkRecordThread_l(ioHandle);
2993 return thread;
3005 PlaybackThread *thread = checkPlaybackThread_l(output);
3006 return thread != NULL && thread->type() != ThreadBase::DIRECT ? (MixerThread *) thread : NULL;
3079 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
3080 if(thread->isDuplicating()) {
3083 AudioStreamOut *output = thread->getOutput();
3085 return thread;
3093 PlaybackThread *thread = primaryPlaybackThread_l();
3095 if (thread == NULL) {
3099 return thread->outDevice();
3107 PlaybackThread *thread = mPlaybackThreads.valueAt(i).get();
3108 if (!thread->isDuplicating()) {
3109 size_t frameCount = thread->frameCountHAL();
3111 (frameCount == minFrameCount && thread->hasFastMixer() &&
3114 minThread = thread;
3368 // look for the thread where the specified audio session is present
3379 // Otherwise it will fail when created on a Playback thread by legacy
3395 // If no output thread contains the requested session ID, default to
3397 // thread when a track with the same session ID is created
3418 ThreadBase *thread = checkRecordThread_l(io);
3419 if (thread == NULL) {
3420 thread = checkPlaybackThread_l(io);
3421 if (thread == NULL) {
3422 thread = checkMmapThread_l(io);
3423 if (thread == NULL) {
3424 ALOGE("createEffect() unknown output thread");
3434 Mutex::Autolock _l(thread->mLock);
3435 thread->addEffectChain_l(chain);
3441 // create effect on selected output thread
3443 handle = thread->createEffect_l(client, effectClient, priority, sessionId,
3506 sp<ThreadBase> thread = getEffectThread_l(sessionId, effectId);
3507 if (thread == nullptr) {
3510 Mutex::Autolock _sl(thread->mLock);
3511 sp<EffectModule> effect = thread->getEffect_l(sessionId, effectId);
3512 thread->setEffectSuspended_l(&effect->desc().type, suspended, sessionId);
3521 ALOGV("moveEffectChain_l() session %d from thread %p to thread %p",
3526 ALOGW("moveEffectChain_l() effect chain for session %d not on source thread %p",
3531 // Check whether the destination thread and all effects in the chain are compatible
3534 " destination thread %p is not compatible with effects in the chain",
3539 // remove chain first. This is useful only if reconfiguring effect chain on same output thread,
3545 // transfer all effects one by one so that new effect chain is created on new thread with
3593 sp<PlaybackThread> thread =
3596 if (EffectId != 0 && thread != 0 && dstThread != thread.get()) {
3598 Mutex::Autolock _sl(thread->mLock);
3599 sp<EffectChain> srcChain = thread->getEffectChain_l(AUDIO_SESSION_OUTPUT_MIX);
3609 thread->removeEffect_l(effect);
3612 thread->addEffect_l(effect);
3619 thread->addEffect_l(effect);
3632 *srcThread = thread;
3672 // when attached to a new record thread