| 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 { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 static const char kValueTrue[] = "true"; | 14 static const char kValueTrue[] = "true"; |
| 15 static const char kValueFalse[] = "false"; | 15 static const char kValueFalse[] = "false"; |
| 16 | 16 |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 MockMediaConstraintFactory::MockMediaConstraintFactory() { | 19 MockMediaConstraintFactory::MockMediaConstraintFactory() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 MockMediaConstraintFactory::~MockMediaConstraintFactory() { | 22 MockMediaConstraintFactory::~MockMediaConstraintFactory() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 blink::WebMediaConstraints | 25 blink::WebMediaConstraints |
| 26 MockMediaConstraintFactory::CreateWebMediaConstraints() { | 26 MockMediaConstraintFactory::CreateWebMediaConstraints() const { |
| 27 blink::WebVector<blink::WebMediaConstraint> mandatory(mandatory_); | 27 blink::WebVector<blink::WebMediaConstraint> mandatory(mandatory_); |
| 28 blink::WebVector<blink::WebMediaConstraint> optional(optional_); | 28 blink::WebVector<blink::WebMediaConstraint> optional(optional_); |
| 29 blink::WebMediaConstraints constraints; | 29 blink::WebMediaConstraints constraints; |
| 30 constraints.initialize(optional, mandatory); | 30 constraints.initialize(optional, mandatory); |
| 31 return constraints; | 31 return constraints; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MockMediaConstraintFactory::AddMandatory(const std::string& key, | 34 void MockMediaConstraintFactory::AddMandatory(const std::string& key, |
| 35 int value) { | 35 int value) { |
| 36 mandatory_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), | 36 mandatory_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 webrtc::MediaConstraintsInterface::kTypingNoiseDetection, | 92 webrtc::MediaConstraintsInterface::kTypingNoiseDetection, |
| 93 webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression | 93 webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression |
| 94 }; | 94 }; |
| 95 MockMediaConstraintFactory factory; | 95 MockMediaConstraintFactory factory; |
| 96 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { | 96 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { |
| 97 AddMandatory(kDefaultAudioConstraints[i], false); | 97 AddMandatory(kDefaultAudioConstraints[i], false); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace content | 101 } // namespace content |
| OLD | NEW |