Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/renderer/media/media_stream_audio_processor_options.h" | 5 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_split.h" | |
| 14 #include "base/strings/string_util.h" | |
| 13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 14 #include "content/common/media/media_stream_options.h" | 16 #include "content/common/media/media_stream_options.h" |
| 15 #include "content/renderer/media/media_stream_constraints_util.h" | 17 #include "content/renderer/media/media_stream_constraints_util.h" |
| 16 #include "content/renderer/media/media_stream_source.h" | 18 #include "content/renderer/media/media_stream_source.h" |
| 17 #include "content/renderer/media/rtc_media_constraints.h" | 19 #include "content/renderer/media/rtc_media_constraints.h" |
| 18 #include "media/audio/audio_parameters.h" | 20 #include "media/audio/audio_parameters.h" |
| 19 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h " | 21 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h " |
| 20 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" | 22 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 | 384 |
| 383 int median = 0, std = 0; | 385 int median = 0, std = 0; |
| 384 float dummy = 0; | 386 float dummy = 0; |
| 385 if (echo_cancellation->GetDelayMetrics(&median, &std, &dummy) == | 387 if (echo_cancellation->GetDelayMetrics(&median, &std, &dummy) == |
| 386 webrtc::AudioProcessing::kNoError) { | 388 webrtc::AudioProcessing::kNoError) { |
| 387 stats->echo_delay_median_ms = median; | 389 stats->echo_delay_median_ms = median; |
| 388 stats->echo_delay_std_ms = std; | 390 stats->echo_delay_std_ms = std; |
| 389 } | 391 } |
| 390 } | 392 } |
| 391 | 393 |
| 394 std::vector<webrtc::Point> ParseArrayGeometry( | |
| 395 const std::string& geometry_string) { | |
| 396 const auto tokens = | |
| 397 base::SplitString(geometry_string, base::kWhitespaceASCII, | |
| 398 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | |
|
emircan
2015/08/03 18:06:23
const auto& tokens?
ajm
2015/08/04 01:16:35
Same comment here. FWIW a bunch of anecdotal calls
| |
| 399 std::vector<webrtc::Point> geometry; | |
| 400 if (tokens.size() < 3 || tokens.size() % 3 != 0) { | |
| 401 LOG(ERROR) << "Malformed geometry string: " << geometry_string; | |
| 402 return geometry; | |
| 403 } | |
| 404 | |
| 405 std::vector<float> float_tokens; | |
| 406 float_tokens.reserve(tokens.size()); | |
| 407 for (const auto& token : tokens) { | |
| 408 double float_token; | |
| 409 if (!base::StringToDouble(token, &float_token)) { | |
| 410 LOG(ERROR) << "Unable to convert token=" << token | |
| 411 << " to double from geometry string: " << geometry_string; | |
| 412 return geometry; | |
| 413 } | |
| 414 float_tokens.push_back(float_token); | |
| 415 } | |
| 416 | |
| 417 geometry.reserve(float_tokens.size() / 3); | |
| 418 for (size_t i = 0; i < float_tokens.size(); i += 3) { | |
| 419 geometry.push_back(webrtc::Point(float_tokens[i + 0], float_tokens[i + 1], | |
| 420 float_tokens[i + 2])); | |
| 421 } | |
| 422 | |
| 423 return geometry; | |
| 424 } | |
| 425 | |
| 392 } // namespace content | 426 } // namespace content |
| OLD | NEW |