Lines Matching refs:patch

298     struct audio_patch patch;
299 patch.num_sources = 1;
300 patch.num_sinks = 1;
311 // release existing RX patch if any
316 // release TX patch if any
328 // of it due to legacy implementation. If not, create a patch.
334 // create RX path audio patch
344 rxSourceDeviceDesc->toAudioPortConfig(&patch.sources[0]);
345 rxSinkDeviceDesc->toAudioPortConfig(&patch.sinks[0]);
357 outputDesc->toAudioPortConfig(&patch.sources[1]);
358 patch.sources[1].ext.mix.usecase.stream = AUDIO_STREAM_PATCH;
359 patch.num_sources = 2;
363 status = mpClientInterface->createAudioPatch(&patch, &afPatchHandle, 0);
364 ALOGW_IF(status != NO_ERROR, "updateCallRouting() error %d creating RX audio patch",
367 mCallRxPatch = new AudioPatch(&patch, mUidCached);
375 struct audio_patch patch;
376 patch.num_sources = 1;
377 patch.num_sinks = 1;
382 txSourceDeviceDesc->toAudioPortConfig(&patch.sources[0]);
387 txSinkDeviceDesc->toAudioPortConfig(&patch.sinks[0]);
400 outputDesc->toAudioPortConfig(&patch.sources[1]);
401 patch.sources[1].ext.mix.usecase.stream = AUDIO_STREAM_PATCH;
402 patch.num_sources = 2;
406 status = mpClientInterface->createAudioPatch(&patch, &afPatchHandle, 0);
407 ALOGW_IF(status != NO_ERROR, "setPhoneState() error %d creating TX audio patch",
410 mCallTxPatch = new AudioPatch(&patch, mUidCached);
2149 status_t AudioPolicyManager::createAudioPatch(const struct audio_patch *patch,
2155 if (handle == NULL || patch == NULL) {
2158 ALOGV("createAudioPatch() num sources %d num sinks %d", patch->num_sources, patch->num_sinks);
2160 if (patch->num_sources == 0 || patch->num_sources > AUDIO_PATCH_PORTS_MAX ||
2161 patch->num_sinks == 0 || patch->num_sinks > AUDIO_PATCH_PORTS_MAX) {
2164 // only one source per audio patch supported for now
2165 if (patch->num_sources > 1) {
2169 if (patch->sources[0].role != AUDIO_PORT_ROLE_SOURCE) {
2172 for (size_t i = 0; i < patch->num_sinks; i++) {
2173 if (patch->sinks[i].role != AUDIO_PORT_ROLE_SINK) {
2181 ALOGV("createAudioPatch source id %d role %d type %d", patch->sources[0].id,
2182 patch->sources[0].role,
2183 patch->sources[0].type);
2185 for (size_t i = 0; i < patch->num_sinks; i++) {
2186 ALOGV("createAudioPatch sink %d: id %d role %d type %d", i, patch->sinks[i].id,
2187 patch->sinks[i].role,
2188 patch->sinks[i].type);
2203 if (patch->sources[0].type == AUDIO_PORT_TYPE_MIX) {
2204 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(patch->sources[0].id);
2206 ALOGV("createAudioPatch() output not found for id %d", patch->sources[0].id);
2212 if (patchDesc->mPatch.sources[0].id != patch->sources[0].id) {
2213 ALOGV("createAudioPatch() source id differs for patch current id %d new id %d",
2214 patchDesc->mPatch.sources[0].id, patch->sources[0].id);
2219 for (size_t i = 0; i < patch->num_sinks; i++) {
2222 if (patch->sinks[i].type != AUDIO_PORT_TYPE_DEVICE) {
2227 mAvailableOutputDevices.getDeviceFromId(patch->sinks[i].id);
2229 ALOGV("createAudioPatch() out device not found for id %d", patch->sinks[i].id);
2235 patch->sources[0].sample_rate,
2237 patch->sources[0].format,
2239 patch->sources[0].channel_mask,
2259 ALOGW("createAudioPatch() setOutputDevice() did not reuse the patch provided");
2265 ALOGW("createAudioPatch() setOutputDevice() failed to create a patch");
2268 } else if (patch->sources[0].type == AUDIO_PORT_TYPE_DEVICE) {
2269 if (patch->sinks[0].type == AUDIO_PORT_TYPE_MIX) {
2272 if (patch->num_sinks > 1) {
2275 sp<AudioInputDescriptor> inputDesc = mInputs.getInputFromId(patch->sinks[0].id);
2280 if (patchDesc->mPatch.sinks[0].id != patch->sinks[0].id) {
2285 mAvailableInputDevices.getDeviceFromId(patch->sources[0].id);
2292 patch->sinks[0].sample_rate,
2294 patch->sinks[0].format,
2296 patch->sinks[0].channel_mask,
2311 ALOGW("createAudioPatch() setInputDevice() did not reuse the patch provided");
2317 ALOGW("createAudioPatch() setInputDevice() failed to create a patch");
2320 } else if (patch->sinks[0].type == AUDIO_PORT_TYPE_DEVICE) {
2323 if (patchDesc->mPatch.sources[0].id != patch->sources[0].id) {
2328 mAvailableInputDevices.getDeviceFromId(patch->sources[0].id);
2333 //update source and sink with our own data as the data passed in the patch may
2335 struct audio_patch newPatch = *patch;
2336 srcDeviceDesc->toAudioPortConfig(&newPatch.sources[0], &patch->sources[0]);
2338 for (size_t i = 0; i < patch->num_sinks; i++) {
2339 if (patch->sinks[i].type != AUDIO_PORT_TYPE_DEVICE) {
2345 mAvailableOutputDevices.getDeviceFromId(patch->sinks[i].id);
2349 sinkDeviceDesc->toAudioPortConfig(&newPatch.sinks[i], &patch->sinks[i]);
2357 if (patch->num_sinks > 1) {
2363 // this output stream by adding a second source to the patch description
2372 outputDesc->toAudioPortConfig(&newPatch.sources[1], &patch->sources[0]);
2388 ALOGV("createAudioPatch() patch panel returned %d patchHandle %d",
2402 ALOGW("createAudioPatch() patch panel could not connect device patch, error %d",
2418 ALOGV("releaseAudioPatch() patch %d", handle);
2432 struct audio_patch *patch = &patchDesc->mPatch;
2434 if (patch->sources[0].type == AUDIO_PORT_TYPE_MIX) {
2435 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(patch->sources[0].id);
2437 ALOGV("releaseAudioPatch() output not found for id %d", patch->sources[0].id);
2446 } else if (patch->sources[0].type == AUDIO_PORT_TYPE_DEVICE) {
2447 if (patch->sinks[0].type == AUDIO_PORT_TYPE_MIX) {
2448 sp<AudioInputDescriptor> inputDesc = mInputs.getInputFromId(patch->sinks[0].id);
2450 ALOGV("releaseAudioPatch() input not found for id %d", patch->sinks[0].id);
2457 } else if (patch->sinks[0].type == AUDIO_PORT_TYPE_DEVICE) {
2460 ALOGV("releaseAudioPatch() patch panel returned %d patchHandle %d",
3387 NULL/*patch handle*/, address.string());
3904 ALOGV("getNewOutputDevice() device %08x forced by patch %d",
3965 ALOGV("getNewInputDevice() device %08x forced by patch %d",
4251 // AND the output is connected by a valid audio patch.
4270 struct audio_patch patch;
4271 outputDesc->toAudioPortConfig(&patch.sources[0]);
4272 patch.num_sources = 1;
4273 patch.num_sinks = 0;
4275 deviceList.itemAt(i)->toAudioPortConfig(&patch.sinks[i]);
4276 patch.num_sinks++;
4291 status_t status = mpClientInterface->createAudioPatch(&patch,
4296 status, afPatchHandle, patch.num_sources, patch.num_sinks);
4299 patchDesc = new AudioPatch(&patch, mUidCached);
4302 patchDesc->mPatch = patch;
4372 struct audio_patch patch;
4373 inputDesc->toAudioPortConfig(&patch.sinks[0]);
4376 if (patch.sinks[0].ext.mix.usecase.source == AUDIO_SOURCE_HOTWORD &&
4378 patch.sinks[0].ext.mix.usecase.source = AUDIO_SOURCE_VOICE_RECOGNITION;
4380 patch.num_sinks = 1;
4382 deviceList.itemAt(0)->toAudioPortConfig(&patch.sources[0]);
4383 patch.num_sources = 1;
4397 status_t status = mpClientInterface->createAudioPatch(&patch,
4404 patchDesc = new AudioPatch(&patch, mUidCached);
4407 patchDesc->mPatch = patch;