CRAS: apm_list - Construct channel layout that works with APM

For input device we could have two channels PCM with the first
channel unconnected. And that introduces a bug in APM use case
because APM processing only uses data in the first channel.
This change fixes the issue by always reconstruct a channel
layout that works with APM.

BUG=b:181818480
TEST=Test online voice recording on 'barla' device.
Unittest to verify all other possible capture channel maps
works.

Change-Id: I1e6ba79d2752a7a541bfbea91dd96bf0f9d38f4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2755524
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
2 files changed