Figure out audio channels automatically |
||||||
Issue description
In audio tests, the audio channels are checked. For example, if the device should have two channels, we will set up a test like this (note the dargs.tests_to_conduct.input_channels):
def SpeakerDMic(self):
OperatorTest(
id='SpeakerDMic',
label_zh=u'喇叭/麦克风',
pytest_name='audio_loop',
dargs={
'require_dongle': False,
'check_dongle': self.audiojack_detection_is_ready,
'cras_enabled': self.cras_enabled_for_audio_test,
'mic_source': 'panel',
'num_input_channels': 4,
'input_dev': ('bxtda7219max', '3'),
'output_dev': ('bxtda7219max', '0'),
'output_volume': 10,
'initial_actions': [('bxtda7219max', 'init')],
'tests_to_conduct': [{'type': 'audiofun',
'duration': 4,
'threshold': 80,
'input_channels': [0, 1]}]})
However, it's very error-prune, since the channels varies across different devices.
It's better if we can figure out the channels automatically (maybe from UCM configs?).
,
Nov 21 2017
Include audio team. Could you give us some insights that, if we can figure out the audio channels automatically? or, you suggested us to hard-coded it for factory tests?
,
Nov 21 2017
Maybe we can have a (good?) guess from HiFi.conf like here: https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/overlay-soraka/chromeos-base/chromeos-bsp-soraka/files/audio-config/ucm-config/kblrt5663max/HiFi.conf#74 But, is it the correct way to do it? Do we need to consider the case when this HiFi.conf is wrong? Is it possible this config 'CaptureChannelMap' does not exist at all?
,
Nov 21 2017
I think HiFi.conf should usually be the right setting - or at least it should be "the one user will be using". So maybe we should do - when not specified, read and use HiFi.conf - when specified in test list args, use the values - stop setting values in test args unless if it's really needed
,
Nov 21 2017
Peter, I think you should just walk down two aisles and ask Jimmy directly. :) It will probably save you more time that way.
,
Nov 21 2017
Peter, I think you should just walk down two aisles and ask Jimmy directly. :) It will probably save you more time that way.
,
Nov 21 2017
HiFi.conf should be the right setting. If it is incorrect, it should be fixed. Only some boards with customized channel map set the CaptureChannelMap flag in HiFi.conf. That flag means, although audio driver reports certain channel maps are available, we always use the one specified in HiFi.conf instead. Note that the tool to read HiFi.conf needs to handle front mic and rear mic on some boards. https://cs.corp.google.com/search/?q=channelmap+HiFi.conf&type=cs
,
Nov 21 2017
Basically you can filter out all "CaptureChannelMap" in the HiFi.conf which might be came from "Internal Mic." / "Front Mic" / "Rear Mic" device section. Then the valid "input_channels" would be the union of all valid channels in "CaptureChannelMap". 1. The value -1 indicates that there is "no available stream for this channel of CRAS". 2. The value 0~3 are the available input stream from SoC.
,
Nov 21 2017
,
Nov 21 2017
The command to query number of channels reported from driver: localhost ~ # alsa_helpers -d hw:0,1 -c Assign device to hw:0,1 channels min=2 channels max=2 2 Channels 2 is supported
,
Nov 21 2017
you can also use arecord to check hw params: localhost ~ # arecord -D hw:0,1 -f dat /dev/null --dump Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo HW Params of device "hw:0,1": -------------------- ACCESS: MMAP_INTERLEAVED RW_INTERLEAVED FORMAT: S8 S16_LE S24_LE SUBFORMAT: STD SAMPLE_BITS: [8 32] FRAME_BITS: [16 64] CHANNELS: 2 RATE: [8000 192000] PERIOD_TIME: (166 16384000] PERIOD_SIZE: [32 131072] PERIOD_BYTES: [256 1048576] PERIODS: [2 8192] BUFFER_TIME: (333 32768000] BUFFER_SIZE: [64 262144] BUFFER_BYTES: [256 524288] TICK_TIME: ALL --------------------
,
Nov 21 2017
Re #6, Thank you for pointing me to the right person. Just have a short discussion with Jimmy. Re #10, #11, A few more notes. The binary 'alsa_helpers' are just created for less than one month. We can use it in our future products, or just use the latest test image for that.
,
Aug 15
Assign to noogler as practice. Note I'm not sure if this bug is still valid.
,
Aug 15
re#13 Yes, it is still valid and this one would depend on crbug.com/788183 . If you can't select HiFi.conf correctly then you can't identify right channels to test.
,
Today
(90 minutes ago)
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by petershih@chromium.org
, Nov 21 2017