summaryrefslogtreecommitdiff
path: root/cras/src/tests/audio_thread_unittest.cc
diff options
context:
space:
mode:
authorCheng-Yi Chiang <cychiang@chromium.org>2014-08-12 19:18:51 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-14 15:29:38 +0000
commit5342a08d8e1f5c3c6205e7c6d2d40ab47280f3a3 (patch)
treeb2d80e769b8a366ec7de187b38cd21a5e8545bd1 /cras/src/tests/audio_thread_unittest.cc
parent3b9e7e54a4615c82d98f65021fb520df57d5ac66 (diff)
downloadadhd-5342a08d8e1f5c3c6205e7c6d2d40ab47280f3a3.tar.gz
CRAS: cras_iodev - Remove software_volume_scaler in cras_iodev
Removes software_volume_scaler in cras_iodev. The scaler will be looked up when audio thread writes data to buffer in possibly_fill_audio. By doing this we do not need to worry which the active node is when the software_volume_scaler is set. The scaler will be determined by system volume, active node volume and software_volume_needed flag. BUG=chrome-os-partner:31101 TEST=make check TEST=On nyan_big, connect to HDMI. Change volume to around 20%. Reboot. Listen to HDMI audio and check volume is around 20%. Change-Id: Idf2c414e87f9271cc7d46dd145d69774aa87391b Reviewed-on: https://chromium-review.googlesource.com/212002 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Diffstat (limited to 'cras/src/tests/audio_thread_unittest.cc')
-rw-r--r--cras/src/tests/audio_thread_unittest.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/cras/src/tests/audio_thread_unittest.cc b/cras/src/tests/audio_thread_unittest.cc
index b3da6b8e..774f4f85 100644
--- a/cras/src/tests/audio_thread_unittest.cc
+++ b/cras/src/tests/audio_thread_unittest.cc
@@ -52,6 +52,7 @@ static struct timespec time_now;
static int cras_fmt_conversion_needed_return_val;
static struct cras_audio_area *dummy_audio_area1;
static struct cras_audio_area *dummy_audio_area2;
+static float cras_iodev_get_software_volume_scaler_return_value;
}
@@ -632,7 +633,6 @@ class WriteStreamSuite : public testing::Test {
iodev_.format = &fmt_;
iodev_.buffer_size = 16384;
iodev_.direction = CRAS_STREAM_OUTPUT;
- iodev_.software_volume_scaler = 1.0;
iodev_.frames_queued = frames_queued;
iodev_.delay_frames = delay_frames;
@@ -677,6 +677,7 @@ class WriteStreamSuite : public testing::Test {
cras_dsp_pipeline_get_delay_called = 0;
cras_dsp_pipeline_apply_called = 0;
cras_dsp_pipeline_apply_sample_count = 0;
+ cras_iodev_get_software_volume_scaler_return_value = 1.0;
dev_running_called_ = 0;
frames_written_ = 0;
@@ -1004,7 +1005,7 @@ TEST_F(WriteStreamSuite, PossiblyFillGetFromStreamNeedFillWithScaler) {
audio_buffer_size_ = buffer_frames_ - frames_queued_;
// Software volume config.
- iodev_.software_volume_scaler = 0.5;
+ cras_iodev_get_software_volume_scaler_return_value = 0.5;
// shm is out of data.
shm_->area->write_offset[0] = 0;
@@ -2381,6 +2382,11 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) {
return 0;
}
+float cras_iodev_get_software_volume_scaler(struct cras_iodev *iodev)
+{
+ return cras_iodev_get_software_volume_scaler_return_value;
+}
+
} // extern "C"
int main(int argc, char **argv) {