Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 776eb210 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audioflinger: Fix stream type for device->device patch

This logic got broken in ag/668511. The stream type was always
extracted from the 2nd patch source, which does not present
for device->device patches.

Test: MSD prototype, USB headset telecom calls in Pixel
Change-Id: Idc8314819010c3a315c5220785a4190e26e55b47
parent 24b61723
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -461,12 +461,16 @@ status_t AudioFlinger::PatchPanel::Patch::createConnections(PatchPanel *panel)

    audio_output_flags_t outputFlags = mAudioPatch.sinks[0].config_mask & AUDIO_PORT_CONFIG_FLAGS ?
            mAudioPatch.sinks[0].flags.output : AUDIO_OUTPUT_FLAG_NONE;

    audio_stream_type_t streamType = AUDIO_STREAM_PATCH;
    if (mAudioPatch.num_sources == 2 && mAudioPatch.sources[1].type == AUDIO_PORT_TYPE_MIX) {
        // "reuse one existing output mix" case
        streamType = mAudioPatch.sources[1].ext.mix.usecase.stream;
    }
    // create a special playback track to render to playback thread.
    // this track is given the same buffer as the PatchRecord buffer
    sp<PlaybackThread::PatchTrack> tempPatchTrack = new (std::nothrow) PlaybackThread::PatchTrack(
                                           mPlayback.thread().get(),
                                           mAudioPatch.sources[1].ext.mix.usecase.stream,
                                           streamType,
                                           sampleRate,
                                           outChannelMask,
                                           format,