Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2377)

Side by Side Diff: media/base/audio_hardware_config_unittest.cc

Issue 2067863003: Mixing audio with different latency requirements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android test fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/audio_hardware_config.cc ('k') | media/base/audio_latency.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 #include "media/base/audio_hardware_config.h" 6 #include "media/base/audio_hardware_config.h"
7 #include "media/base/audio_parameters.h" 7 #include "media/base/audio_parameters.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 AudioParameters::AUDIO_PCM_LOW_LATENCY, 81 AudioParameters::AUDIO_PCM_LOW_LATENCY,
82 kNewInputChannelLayout, 82 kNewInputChannelLayout,
83 kNewInputSampleRate, 83 kNewInputSampleRate,
84 16, 84 16,
85 kOutputBufferSize); 85 kOutputBufferSize);
86 fake_config.UpdateInputConfig(new_input_params); 86 fake_config.UpdateInputConfig(new_input_params);
87 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate()); 87 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate());
88 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout()); 88 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
89 } 89 }
90 90
91 TEST(AudioHardwareConfig, HighLatencyBufferSizes) {
92 AudioParameters input_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
93 kInputChannelLayout,
94 kInputSampleRate,
95 16,
96 kOutputBufferSize);
97 AudioParameters output_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
98 kOutputChannelLayout,
99 3200,
100 16,
101 32);
102 AudioHardwareConfig fake_config(input_params, output_params);
103
104 #if defined(OS_WIN)
105 for (int i = 6400; i <= 204800; i *= 2) {
106 fake_config.UpdateOutputConfig(
107 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
108 kOutputChannelLayout,
109 i,
110 16,
111 i / 100));
112 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize());
113 }
114 #else
115 EXPECT_EQ(64, fake_config.GetHighLatencyBufferSize());
116
117 for (int i = 6400; i <= 204800; i *= 2) {
118 fake_config.UpdateOutputConfig(
119 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
120 kOutputChannelLayout,
121 i,
122 16,
123 32));
124 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize());
125 }
126 #endif // defined(OS_WIN)
127 }
128
129 } // namespace content 91 } // namespace content
OLDNEW
« no previous file with comments | « media/base/audio_hardware_config.cc ('k') | media/base/audio_latency.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698