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
diff --git a/services/audioflinger/PatchPanel.cpp b/services/audioflinger/PatchPanel.cpp
index 7f46747..331db48 100644
--- a/services/audioflinger/PatchPanel.cpp
+++ b/services/audioflinger/PatchPanel.cpp
@@ -461,12 +461,16 @@
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,