OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/renderer/media/mock_media_constraint_factory.h" | 7 #include "content/renderer/media/mock_media_constraint_factory.h" |
8 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 8 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 19 matching lines...) Expand all Loading... |
30 base::IntToString16(value))); | 30 base::IntToString16(value))); |
31 } | 31 } |
32 | 32 |
33 void MockMediaConstraintFactory::AddMandatory(const std::string& key, | 33 void MockMediaConstraintFactory::AddMandatory(const std::string& key, |
34 double value) { | 34 double value) { |
35 mandatory_.push_back(blink::WebMediaConstraint( | 35 mandatory_.push_back(blink::WebMediaConstraint( |
36 base::UTF8ToUTF16(key), | 36 base::UTF8ToUTF16(key), |
37 base::UTF8ToUTF16(base::DoubleToString(value)))); | 37 base::UTF8ToUTF16(base::DoubleToString(value)))); |
38 } | 38 } |
39 | 39 |
| 40 void MockMediaConstraintFactory::AddMandatory(const std::string& key, |
| 41 const std::string& value) { |
| 42 mandatory_.push_back(blink::WebMediaConstraint( |
| 43 base::UTF8ToUTF16(key), base::UTF8ToUTF16(value))); |
| 44 } |
| 45 |
40 void MockMediaConstraintFactory::AddOptional(const std::string& key, | 46 void MockMediaConstraintFactory::AddOptional(const std::string& key, |
41 int value) { | 47 int value) { |
42 optional_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), | 48 optional_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), |
43 base::IntToString16(value))); | 49 base::IntToString16(value))); |
44 } | 50 } |
45 | 51 |
46 void MockMediaConstraintFactory::AddOptional(const std::string& key, | 52 void MockMediaConstraintFactory::AddOptional(const std::string& key, |
47 double value) { | 53 double value) { |
48 optional_.push_back(blink::WebMediaConstraint( | 54 optional_.push_back(blink::WebMediaConstraint( |
49 base::UTF8ToUTF16(key), | 55 base::UTF8ToUTF16(key), |
50 base::UTF8ToUTF16(base::DoubleToString(value)))); | 56 base::UTF8ToUTF16(base::DoubleToString(value)))); |
51 } | 57 } |
52 | 58 |
| 59 void MockMediaConstraintFactory::AddOptional(const std::string& key, |
| 60 const std::string& value) { |
| 61 optional_.push_back(blink::WebMediaConstraint( |
| 62 base::UTF8ToUTF16(key), base::UTF8ToUTF16(value))); |
| 63 } |
| 64 |
53 void MockMediaConstraintFactory::DisableDefaultAudioConstraints() { | 65 void MockMediaConstraintFactory::DisableDefaultAudioConstraints() { |
54 static const char* kDefaultAudioConstraints[] = { | 66 static const char* kDefaultAudioConstraints[] = { |
55 webrtc::MediaConstraintsInterface::kEchoCancellation, | 67 webrtc::MediaConstraintsInterface::kEchoCancellation, |
56 webrtc::MediaConstraintsInterface::kExperimentalEchoCancellation, | 68 webrtc::MediaConstraintsInterface::kExperimentalEchoCancellation, |
57 webrtc::MediaConstraintsInterface::kAutoGainControl, | 69 webrtc::MediaConstraintsInterface::kAutoGainControl, |
58 webrtc::MediaConstraintsInterface::kExperimentalAutoGainControl, | 70 webrtc::MediaConstraintsInterface::kExperimentalAutoGainControl, |
59 webrtc::MediaConstraintsInterface::kNoiseSuppression, | 71 webrtc::MediaConstraintsInterface::kNoiseSuppression, |
60 webrtc::MediaConstraintsInterface::kHighpassFilter, | 72 webrtc::MediaConstraintsInterface::kHighpassFilter, |
61 webrtc::MediaConstraintsInterface::kTypingNoiseDetection, | 73 webrtc::MediaConstraintsInterface::kTypingNoiseDetection, |
62 webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression | 74 webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression |
63 }; | 75 }; |
64 MockMediaConstraintFactory factory; | 76 MockMediaConstraintFactory factory; |
65 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) { | 77 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) { |
66 AddMandatory(kDefaultAudioConstraints[i], false); | 78 AddMandatory(kDefaultAudioConstraints[i], false); |
67 } | 79 } |
68 } | 80 } |
69 | 81 |
70 } // namespace content | 82 } // namespace content |
OLD | NEW |