| Index: client/site_tests/audiovideo_Microphone/audiovideo_Microphone.py
|
| diff --git a/client/site_tests/audiovideo_Microphone/audiovideo_Microphone.py b/client/site_tests/audiovideo_Microphone/audiovideo_Microphone.py
|
| index b1dbbbc799737d0564acaf771bf8a94c0be731bb..fa8e5c37ff7ec8f0bd949e9a10d1d45fdb98169f 100644
|
| --- a/client/site_tests/audiovideo_Microphone/audiovideo_Microphone.py
|
| +++ b/client/site_tests/audiovideo_Microphone/audiovideo_Microphone.py
|
| @@ -2,7 +2,7 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -import os, time
|
| +import os, time, utils
|
|
|
| from autotest_lib.client.bin import test, utils
|
| from autotest_lib.client.common_lib import error
|
| @@ -18,12 +18,8 @@ class audiovideo_Microphone(test.test):
|
| file_name = "/tmp/%s-%s.capture" % (ch, rate)
|
| cmd = "rm -f %s" % file_name
|
| utils.system(cmd, ignore_status=True)
|
| - cmd = "/usr/bin/pkill pacat"
|
| - utils.system(cmd, ignore_status=True)
|
| - cmd = "pacat -r --channels=%s --rate=%s %s &" % (ch, rate, file_name)
|
| - utils.system(cmd)
|
| - time.sleep(DURATION)
|
| - cmd = "/usr/bin/pkill pacat"
|
| + cmd = "arecord -f dat -D default -c %s -r %s -d %d %s"
|
| + cmd = cmd % (ch, rate, DURATION, file_name)
|
| utils.system(cmd)
|
| size = os.path.getsize(file_name)
|
| if (size < DURATION * rate * ch * BYTES_PER_SAMPLE * TOLERATE) :
|
| @@ -32,17 +28,24 @@ class audiovideo_Microphone(test.test):
|
|
|
|
|
| def run_once(self):
|
| + cpuType = utils.get_cpu_arch()
|
| # Microphone should be on by default.
|
| - cmd = 'amixer -c 0 cget name="Capture Switch" | grep values=on,on'
|
| - output = utils.system_output(cmd)
|
| - if (output == ''):
|
| - raise error.TestFail('The microphone is not on by default.')
|
| + if cpuType != "arm":
|
| + cmd = 'amixer -c 0 cget name="Capture Switch" | grep values=on,on'
|
| + output = utils.system_output(cmd)
|
| + if (output == ''):
|
| + raise error.TestFail('The microphone is not on by default.')
|
| + else:
|
| + # TODO(jiesun): find consistent way to find the ALSA mixer control
|
| + # names for both internal mic and external mic on ARM, which is
|
| + # independent of the audio codec hardware vendor.
|
| + print "Warning: Can not verify the microphone capture switch."
|
|
|
| # Mono and stereo capturing should work fine @ 44.1KHz and 48KHz.
|
| self.verify_capture(1, 44100)
|
| self.verify_capture(1, 48000)
|
| - self.verify_capture(2, 44100)
|
| self.verify_capture(2, 48000)
|
| + self.verify_capture(2, 44100)
|
|
|
| # TODO(zhurunz):
|
| # Low latency capturing should work fine with low CPU usage.
|
|
|