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

Side by Side Diff: components/audio_modem/modem_impl.cc

Issue 865483005: Creating the audio_modem component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes Created 5 years, 10 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 | « components/audio_modem/modem_impl.h ('k') | components/audio_modem/modem_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/copresence/mediums/audio/audio_manager_impl.h" 5 #include "components/audio_modem/modem_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h"
15 #include "base/run_loop.h" 16 #include "base/run_loop.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "components/copresence/copresence_switches.h" 21 #include "components/audio_modem/audio_modem_switches.h"
21 #include "components/copresence/mediums/audio/audio_player_impl.h" 22 #include "components/audio_modem/audio_player_impl.h"
22 #include "components/copresence/mediums/audio/audio_recorder_impl.h" 23 #include "components/audio_modem/audio_recorder_impl.h"
23 #include "components/copresence/public/copresence_constants.h" 24 #include "components/audio_modem/public/whispernet_client.h"
24 #include "components/copresence/public/whispernet_client.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "media/audio/audio_manager.h" 26 #include "media/audio/audio_manager.h"
27 #include "media/audio/audio_manager_base.h" 27 #include "media/audio/audio_manager_base.h"
28 #include "media/base/audio_bus.h" 28 #include "media/base/audio_bus.h"
29 #include "third_party/webrtc/common_audio/wav_file.h" 29 #include "third_party/webrtc/common_audio/wav_file.h"
30 30
31 namespace copresence { 31 namespace audio_modem {
32 32
33 namespace { 33 namespace {
34 34
35 const int kSampleExpiryTimeMs = 60 * 60 * 1000; // 60 minutes.
36 const int kMaxSamples = 10000; 35 const int kMaxSamples = 10000;
37 const int kTokenTimeoutMs = 2000; 36 const int kTokenTimeoutMs = 2000;
38 const int kMonoChannelCount = 1; 37 const int kMonoChannelCount = 1;
39 38
40 // UrlSafe is defined as: 39 // UrlSafe is defined as:
41 // '/' represented by a '_' and '+' represented by a '-' 40 // '/' represented by a '_' and '+' represented by a '-'
42 // TODO(ckehoe): Move this to a central place. 41 // TODO(ckehoe): Move this to a central place.
43 std::string FromUrlSafe(std::string token) { 42 std::string FromUrlSafe(std::string token) {
44 base::ReplaceChars(token, "-", "+", &token); 43 base::ReplaceChars(token, "-", "+", &token);
45 base::ReplaceChars(token, "_", "/", &token); 44 base::ReplaceChars(token, "_", "/", &token);
(...skipping 27 matching lines...) Expand all
73 << "Unrecognized value \"" << flag_value << " for flag " 72 << "Unrecognized value \"" << flag_value << " for flag "
74 << flag << ". Defaulting to " << default_value; 73 << flag << ". Defaulting to " << default_value;
75 return default_value; 74 return default_value;
76 } 75 }
77 76
78 } // namespace 77 } // namespace
79 78
80 79
81 // Public functions. 80 // Public functions.
82 81
83 AudioManagerImpl::AudioManagerImpl() 82 ModemImpl::ModemImpl() : client_(nullptr), recorder_(nullptr) {
84 : whispernet_client_(nullptr), recorder_(nullptr) {
85 // TODO(rkc): Move all of these into initializer lists once it is allowed. 83 // TODO(rkc): Move all of these into initializer lists once it is allowed.
86 should_be_playing_[AUDIBLE] = false; 84 should_be_playing_[AUDIBLE] = false;
87 should_be_playing_[INAUDIBLE] = false; 85 should_be_playing_[INAUDIBLE] = false;
88 should_be_recording_[AUDIBLE] = false; 86 should_be_recording_[AUDIBLE] = false;
89 should_be_recording_[INAUDIBLE] = false; 87 should_be_recording_[INAUDIBLE] = false;
90 88
91 player_enabled_[AUDIBLE] = ReadBooleanFlag( 89 player_enabled_[AUDIBLE] = ReadBooleanFlag(
92 switches::kCopresenceEnableAudibleBroadcast, true); 90 switches::kAudioModemEnableAudibleBroadcast, true);
93 player_enabled_[INAUDIBLE] = ReadBooleanFlag( 91 player_enabled_[INAUDIBLE] = ReadBooleanFlag(
94 switches::kCopresenceEnableInaudibleBroadcast, true); 92 switches::kAudioModemEnableInaudibleBroadcast, true);
95 player_[AUDIBLE] = nullptr; 93 player_[AUDIBLE] = nullptr;
96 player_[INAUDIBLE] = nullptr; 94 player_[INAUDIBLE] = nullptr;
97 token_length_[0] = 0; 95 token_length_[0] = 0;
98 token_length_[1] = 0; 96 token_length_[1] = 0;
97
98 samples_caches_.resize(2);
99 samples_caches_[AUDIBLE] = new SamplesMap(kMaxSamples);
100 samples_caches_[INAUDIBLE] = new SamplesMap(kMaxSamples);
99 } 101 }
100 102
101 void AudioManagerImpl::Initialize(WhispernetClient* whispernet_client, 103 void ModemImpl::Initialize(WhispernetClient* client,
102 const TokensCallback& tokens_cb) { 104 const TokensCallback& tokens_cb) {
103 samples_cache_.resize(2); 105 DCHECK(client);
104 samples_cache_[AUDIBLE] = new SamplesMap( 106 client_ = client;
105 base::TimeDelta::FromMilliseconds(kSampleExpiryTimeMs), kMaxSamples);
106 samples_cache_[INAUDIBLE] = new SamplesMap(
107 base::TimeDelta::FromMilliseconds(kSampleExpiryTimeMs), kMaxSamples);
108
109 DCHECK(whispernet_client);
110 whispernet_client_ = whispernet_client;
111 tokens_cb_ = tokens_cb; 107 tokens_cb_ = tokens_cb;
112 108
113 // These will be unregistered on destruction, so unretained is safe to use. 109 // These will be unregistered on destruction, so unretained is safe to use.
114 whispernet_client_->RegisterTokensCallback( 110 client_->RegisterTokensCallback(
115 base::Bind(&AudioManagerImpl::OnTokensFound, base::Unretained(this))); 111 base::Bind(&ModemImpl::OnTokensFound, base::Unretained(this)));
116 whispernet_client_->RegisterSamplesCallback( 112 client_->RegisterSamplesCallback(
117 base::Bind(&AudioManagerImpl::OnTokenEncoded, base::Unretained(this))); 113 base::Bind(&ModemImpl::OnTokenEncoded, base::Unretained(this)));
118 114
119 if (!player_[AUDIBLE]) 115 if (!player_[AUDIBLE])
120 player_[AUDIBLE] = new AudioPlayerImpl(); 116 player_[AUDIBLE] = new AudioPlayerImpl();
121 player_[AUDIBLE]->Initialize(); 117 player_[AUDIBLE]->Initialize();
122 118
123 if (!player_[INAUDIBLE]) 119 if (!player_[INAUDIBLE])
124 player_[INAUDIBLE] = new AudioPlayerImpl(); 120 player_[INAUDIBLE] = new AudioPlayerImpl();
125 player_[INAUDIBLE]->Initialize(); 121 player_[INAUDIBLE]->Initialize();
126 122
127 decode_cancelable_cb_.Reset(base::Bind( 123 decode_cancelable_cb_.Reset(base::Bind(
128 &AudioManagerImpl::DecodeSamplesConnector, base::Unretained(this))); 124 &ModemImpl::DecodeSamplesConnector, base::Unretained(this)));
129 if (!recorder_) 125 if (!recorder_)
130 recorder_ = new AudioRecorderImpl(); 126 recorder_ = new AudioRecorderImpl();
131 recorder_->Initialize(decode_cancelable_cb_.callback()); 127 recorder_->Initialize(decode_cancelable_cb_.callback());
132 128
133 dump_tokens_dir_ = base::FilePath(base::CommandLine::ForCurrentProcess() 129 dump_tokens_dir_ = base::FilePath(base::CommandLine::ForCurrentProcess()
134 ->GetSwitchValueNative(switches::kCopresenceDumpTokensToDir)); 130 ->GetSwitchValueNative(switches::kAudioModemDumpTokensToDir));
135 } 131 }
136 132
137 AudioManagerImpl::~AudioManagerImpl() { 133 ModemImpl::~ModemImpl() {
138 if (player_[AUDIBLE]) 134 if (player_[AUDIBLE])
139 player_[AUDIBLE]->Finalize(); 135 player_[AUDIBLE]->Finalize();
140 if (player_[INAUDIBLE]) 136 if (player_[INAUDIBLE])
141 player_[INAUDIBLE]->Finalize(); 137 player_[INAUDIBLE]->Finalize();
142 if (recorder_) 138 if (recorder_)
143 recorder_->Finalize(); 139 recorder_->Finalize();
144 140
145 // Whispernet initialization may never have completed. 141 // Whispernet initialization may never have completed.
146 if (whispernet_client_) { 142 if (client_) {
147 whispernet_client_->RegisterTokensCallback(TokensCallback()); 143 client_->RegisterTokensCallback(TokensCallback());
148 whispernet_client_->RegisterSamplesCallback(SamplesCallback()); 144 client_->RegisterSamplesCallback(SamplesCallback());
149 } 145 }
150 } 146 }
151 147
152 void AudioManagerImpl::StartPlaying(AudioType type) { 148 void ModemImpl::StartPlaying(AudioType type) {
153 DCHECK(type == AUDIBLE || type == INAUDIBLE); 149 DCHECK(type == AUDIBLE || type == INAUDIBLE);
154 should_be_playing_[type] = true; 150 should_be_playing_[type] = true;
155 // If we don't have our token encoded yet, this check will be false, for now. 151 // If we don't have our token encoded yet, this check will be false, for now.
156 // Once our token is encoded, OnTokenEncoded will call UpdateToken, which 152 // Once our token is encoded, OnTokenEncoded will call UpdateToken, which
157 // will call this code again (if we're still supposed to be playing). 153 // will call this code again (if we're still supposed to be playing).
158 if (samples_cache_[type]->HasKey(playing_token_[type])) { 154 SamplesMap::iterator samples =
155 samples_caches_[type]->Get(playing_token_[type]);
156 if (samples != samples_caches_[type]->end()) {
159 DCHECK(!playing_token_[type].empty()); 157 DCHECK(!playing_token_[type].empty());
160 if (player_enabled_[type]) { 158 if (player_enabled_[type]) {
161 started_playing_[type] = base::Time::Now(); 159 started_playing_[type] = base::Time::Now();
162 player_[type]->Play(samples_cache_[type]->GetValue(playing_token_[type])); 160 player_[type]->Play(samples->second);
163 161
164 // If we're playing, we always record to hear what we are playing. 162 // If we're playing, we always record to hear what we are playing.
165 recorder_->Record(); 163 recorder_->Record();
166 } else { 164 } else {
167 DVLOG(3) << "Skipping playback for disabled " << AudioTypeToString(type) 165 DVLOG(3) << "Skipping playback for disabled " << AudioTypeToString(type)
168 << " player."; 166 << " player.";
169 } 167 }
170 } 168 }
171 } 169 }
172 170
173 void AudioManagerImpl::StopPlaying(AudioType type) { 171 void ModemImpl::StopPlaying(AudioType type) {
174 DCHECK(type == AUDIBLE || type == INAUDIBLE); 172 DCHECK(type == AUDIBLE || type == INAUDIBLE);
175 should_be_playing_[type] = false; 173 should_be_playing_[type] = false;
176 player_[type]->Stop(); 174 player_[type]->Stop();
177 // If we were only recording to hear our own played tokens, stop. 175 // If we were only recording to hear our own played tokens, stop.
178 if (!should_be_recording_[AUDIBLE] && !should_be_recording_[INAUDIBLE]) 176 if (!should_be_recording_[AUDIBLE] && !should_be_recording_[INAUDIBLE])
179 recorder_->Stop(); 177 recorder_->Stop();
180 playing_token_[type] = std::string(); 178 playing_token_[type] = std::string();
181 } 179 }
182 180
183 void AudioManagerImpl::StartRecording(AudioType type) { 181 void ModemImpl::StartRecording(AudioType type) {
184 DCHECK(type == AUDIBLE || type == INAUDIBLE); 182 DCHECK(type == AUDIBLE || type == INAUDIBLE);
185 should_be_recording_[type] = true; 183 should_be_recording_[type] = true;
186 recorder_->Record(); 184 recorder_->Record();
187 } 185 }
188 186
189 void AudioManagerImpl::StopRecording(AudioType type) { 187 void ModemImpl::StopRecording(AudioType type) {
190 DCHECK(type == AUDIBLE || type == INAUDIBLE); 188 DCHECK(type == AUDIBLE || type == INAUDIBLE);
191 should_be_recording_[type] = false; 189 should_be_recording_[type] = false;
192 recorder_->Stop(); 190 recorder_->Stop();
193 } 191 }
194 192
195 void AudioManagerImpl::SetToken(AudioType type, 193 void ModemImpl::SetToken(AudioType type,
196 const std::string& url_safe_token) { 194 const std::string& url_safe_token) {
197 DCHECK(type == AUDIBLE || type == INAUDIBLE); 195 DCHECK(type == AUDIBLE || type == INAUDIBLE);
198 std::string token = FromUrlSafe(url_safe_token); 196 std::string token = FromUrlSafe(url_safe_token);
199 if (!samples_cache_[type]->HasKey(token)) { 197 if (samples_caches_[type]->Get(token) == samples_caches_[type]->end()) {
200 whispernet_client_->EncodeToken(token, type); 198 client_->EncodeToken(token, type);
201 } else { 199 } else {
202 UpdateToken(type, token); 200 UpdateToken(type, token);
203 } 201 }
204 } 202 }
205 203
206 const std::string AudioManagerImpl::GetToken(AudioType type) { 204 const std::string ModemImpl::GetToken(AudioType type) {
207 return playing_token_[type]; 205 return playing_token_[type];
208 } 206 }
209 207
210 bool AudioManagerImpl::IsPlayingTokenHeard(AudioType type) { 208 bool ModemImpl::IsPlayingTokenHeard(AudioType type) {
211 base::TimeDelta tokenTimeout = 209 base::TimeDelta tokenTimeout =
212 base::TimeDelta::FromMilliseconds(kTokenTimeoutMs); 210 base::TimeDelta::FromMilliseconds(kTokenTimeoutMs);
213 211
214 // This is a bit of a hack. If we haven't been playing long enough, 212 // This is a bit of a hack. If we haven't been playing long enough,
215 // return true to avoid tripping an audio fail alarm. 213 // return true to avoid tripping an audio fail alarm.
216 if (base::Time::Now() - started_playing_[type] < tokenTimeout) 214 if (base::Time::Now() - started_playing_[type] < tokenTimeout)
217 return true; 215 return true;
218 216
219 return base::Time::Now() - heard_own_token_[type] < tokenTimeout; 217 return base::Time::Now() - heard_own_token_[type] < tokenTimeout;
220 } 218 }
221 219
222 void AudioManagerImpl::SetTokenLength(AudioType type, size_t token_length) { 220 void ModemImpl::SetTokenLength(AudioType type, size_t token_length) {
223 token_length_[type] = token_length; 221 token_length_[type] = token_length;
224 } 222 }
225 223
224 // static
225 scoped_ptr<Modem> Modem::Create() {
226 return make_scoped_ptr<Modem>(new ModemImpl);
227 }
226 228
227 // Private functions. 229 // Private functions.
228 230
229 void AudioManagerImpl::OnTokenEncoded( 231 void ModemImpl::OnTokenEncoded(
230 AudioType type, 232 AudioType type,
231 const std::string& token, 233 const std::string& token,
232 const scoped_refptr<media::AudioBusRefCounted>& samples) { 234 const scoped_refptr<media::AudioBusRefCounted>& samples) {
233 samples_cache_[type]->Add(token, samples); 235 samples_caches_[type]->Put(token, samples);
234 DumpToken(type, token, samples.get()); 236 DumpToken(type, token, samples.get());
235 UpdateToken(type, token); 237 UpdateToken(type, token);
236 } 238 }
237 239
238 void AudioManagerImpl::OnTokensFound(const std::vector<AudioToken>& tokens) { 240 void ModemImpl::OnTokensFound(const std::vector<AudioToken>& tokens) {
239 std::vector<AudioToken> tokens_to_report; 241 std::vector<AudioToken> tokens_to_report;
240 for (const auto& token : tokens) { 242 for (const auto& token : tokens) {
241 AudioType type = token.audible ? AUDIBLE : INAUDIBLE; 243 AudioType type = token.audible ? AUDIBLE : INAUDIBLE;
242 if (playing_token_[type] == token.token) 244 if (playing_token_[type] == token.token)
243 heard_own_token_[type] = base::Time::Now(); 245 heard_own_token_[type] = base::Time::Now();
244 246
245 if (should_be_recording_[AUDIBLE] && token.audible) { 247 if (should_be_recording_[AUDIBLE] && token.audible) {
246 tokens_to_report.push_back(token); 248 tokens_to_report.push_back(token);
247 } else if (should_be_recording_[INAUDIBLE] && !token.audible) { 249 } else if (should_be_recording_[INAUDIBLE] && !token.audible) {
248 tokens_to_report.push_back(token); 250 tokens_to_report.push_back(token);
249 } 251 }
250 } 252 }
251 253
252 if (!tokens_to_report.empty()) 254 if (!tokens_to_report.empty())
253 tokens_cb_.Run(tokens_to_report); 255 tokens_cb_.Run(tokens_to_report);
254 } 256 }
255 257
256 void AudioManagerImpl::UpdateToken(AudioType type, const std::string& token) { 258 void ModemImpl::UpdateToken(AudioType type, const std::string& token) {
257 DCHECK(type == AUDIBLE || type == INAUDIBLE); 259 DCHECK(type == AUDIBLE || type == INAUDIBLE);
258 if (playing_token_[type] == token) 260 if (playing_token_[type] == token)
259 return; 261 return;
260 262
261 // Update token. 263 // Update token.
262 playing_token_[type] = token; 264 playing_token_[type] = token;
263 265
264 // If we are supposed to be playing this token type at this moment, switch 266 // If we are supposed to be playing this token type at this moment, switch
265 // out playback with the new samples. 267 // out playback with the new samples.
266 if (should_be_playing_[type]) 268 if (should_be_playing_[type])
267 RestartPlaying(type); 269 RestartPlaying(type);
268 } 270 }
269 271
270 void AudioManagerImpl::RestartPlaying(AudioType type) { 272 void ModemImpl::RestartPlaying(AudioType type) {
271 DCHECK(type == AUDIBLE || type == INAUDIBLE); 273 DCHECK(type == AUDIBLE || type == INAUDIBLE);
272 // We should already have this token in the cache. This function is not 274 // We should already have this token in the cache. This function is not
273 // called from anywhere except update token and only once we have our samples 275 // called from anywhere except update token and only once we have our samples
274 // in the cache. 276 // in the cache.
275 DCHECK(samples_cache_[type]->HasKey(playing_token_[type])); 277 DCHECK(samples_caches_[type]->Get(playing_token_[type]) !=
278 samples_caches_[type]->end());
276 279
277 player_[type]->Stop(); 280 player_[type]->Stop();
278 StartPlaying(type); 281 StartPlaying(type);
279 } 282 }
280 283
281 void AudioManagerImpl::DecodeSamplesConnector(const std::string& samples) { 284 void ModemImpl::DecodeSamplesConnector(const std::string& samples) {
282 // If we are either supposed to be recording *or* playing, audible or 285 // If we are either supposed to be recording *or* playing, audible or
283 // inaudible, we should be decoding that type. This is so that if we are 286 // inaudible, we should be decoding that type. This is so that if we are
284 // just playing, we will still decode our recorded token so we can check 287 // just playing, we will still decode our recorded token so we can check
285 // if we heard our own token. Whether or not we report the token to the 288 // if we heard our own token. Whether or not we report the token to the
286 // server is checked for and handled in OnTokensFound. 289 // server is checked for and handled in OnTokensFound.
287 290
288 bool decode_audible = 291 bool decode_audible =
289 should_be_recording_[AUDIBLE] || should_be_playing_[AUDIBLE]; 292 should_be_recording_[AUDIBLE] || should_be_playing_[AUDIBLE];
290 bool decode_inaudible = 293 bool decode_inaudible =
291 should_be_recording_[INAUDIBLE] || should_be_playing_[INAUDIBLE]; 294 should_be_recording_[INAUDIBLE] || should_be_playing_[INAUDIBLE];
292 295
293 if (decode_audible && decode_inaudible) { 296 if (decode_audible && decode_inaudible) {
294 whispernet_client_->DecodeSamples(BOTH, samples, token_length_); 297 client_->DecodeSamples(BOTH, samples, token_length_);
295 } else if (decode_audible) { 298 } else if (decode_audible) {
296 whispernet_client_->DecodeSamples(AUDIBLE, samples, token_length_); 299 client_->DecodeSamples(AUDIBLE, samples, token_length_);
297 } else if (decode_inaudible) { 300 } else if (decode_inaudible) {
298 whispernet_client_->DecodeSamples(INAUDIBLE, samples, token_length_); 301 client_->DecodeSamples(INAUDIBLE, samples, token_length_);
299 } 302 }
300 } 303 }
301 304
302 void AudioManagerImpl::DumpToken(AudioType audio_type, 305 void ModemImpl::DumpToken(AudioType audio_type,
Andrew MacDonald 2015/02/10 04:27:55 Did you just want me to review this? Or is there s
Charlie 2015/02/10 05:14:19 Yes, just this. Your LG is required because it's b
303 const std::string& token, 306 const std::string& token,
304 const media::AudioBus* samples) { 307 const media::AudioBus* samples) {
305 if (dump_tokens_dir_.empty()) 308 if (dump_tokens_dir_.empty())
306 return; 309 return;
307 310
308 // Convert the samples to 16-bit integers. 311 // Convert the samples to 16-bit integers.
309 std::vector<int16_t> int_samples; 312 std::vector<int16_t> int_samples;
310 int_samples.reserve(samples->frames()); 313 int_samples.reserve(samples->frames());
311 for (int i = 0; i < samples->frames(); i++) { 314 for (int i = 0; i < samples->frames(); i++) {
312 int_samples.push_back(round( 315 int_samples.push_back(round(
313 samples->channel(0)[i] * std::numeric_limits<int16_t>::max())); 316 samples->channel(0)[i] * std::numeric_limits<int16_t>::max()));
314 } 317 }
(...skipping 10 matching lines...) Expand all
325 base::SysNativeMBToWide(filename)); 328 base::SysNativeMBToWide(filename));
326 file_str = base::SysWideToNativeMB(file_path.value()); 329 file_str = base::SysWideToNativeMB(file_path.value());
327 #else 330 #else
328 file_str = dump_tokens_dir_.Append(filename).value(); 331 file_str = dump_tokens_dir_.Append(filename).value();
329 #endif 332 #endif
330 333
331 webrtc::WavWriter writer(file_str, kDefaultSampleRate, kMonoChannelCount); 334 webrtc::WavWriter writer(file_str, kDefaultSampleRate, kMonoChannelCount);
332 writer.WriteSamples(int_samples.data(), int_samples.size()); 335 writer.WriteSamples(int_samples.data(), int_samples.size());
333 } 336 }
334 337
335 } // namespace copresence 338 } // namespace audio_modem
OLDNEW
« no previous file with comments | « components/audio_modem/modem_impl.h ('k') | components/audio_modem/modem_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698