Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/strings/string_number_conversions.h" | |
| 6 #include "base/strings/utf_string_conversions.h" | |
| 7 #include "content/renderer/media/mock_media_constraint_factory.h" | |
| 8 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 MockMediaConstraintFactory::MockMediaConstraintFactory() { | |
| 13 } | |
| 14 | |
| 15 MockMediaConstraintFactory::~MockMediaConstraintFactory() { | |
| 16 } | |
| 17 | |
| 18 blink::WebMediaConstraints | |
| 19 MockMediaConstraintFactory::CreateWebMediaConstraints() { | |
| 20 blink::WebVector<blink::WebMediaConstraint> mandatory(mandatory_); | |
| 21 blink::WebVector<blink::WebMediaConstraint> optional(optional_); | |
| 22 blink::WebMediaConstraints constraints; | |
| 23 constraints.initialize(optional, mandatory); | |
| 24 return constraints; | |
| 25 } | |
| 26 | |
| 27 void MockMediaConstraintFactory::AddMandatory(const std::string& key, | |
| 28 int value) { | |
| 29 mandatory_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), | |
| 30 base::IntToString16(value))); | |
| 31 } | |
| 32 | |
| 33 void MockMediaConstraintFactory::AddMandatory(const std::string& key, | |
| 34 double value) { | |
| 35 mandatory_.push_back(blink::WebMediaConstraint( | |
| 36 base::UTF8ToUTF16(key), | |
| 37 base::UTF8ToUTF16(base::DoubleToString(value)))); | |
| 38 } | |
| 39 | |
| 40 void MockMediaConstraintFactory::AddOptional(const std::string& key, | |
| 41 int value) { | |
| 42 optional_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key), | |
| 43 base::IntToString16(value))); | |
| 44 } | |
| 45 | |
| 46 void MockMediaConstraintFactory::AddOptional(const std::string& key, | |
| 47 double value) { | |
| 48 optional_.push_back(blink::WebMediaConstraint( | |
| 49 base::UTF8ToUTF16(key), | |
| 50 base::UTF8ToUTF16(base::DoubleToString(value)))); | |
| 51 } | |
| 52 | |
| 53 void MockMediaConstraintFactory::DisableDefaultAudioConstraints() { | |
| 54 static const char* kDefaultAudioConstraints[] = { | |
| 55 webrtc::MediaConstraintsInterface::kEchoCancellation, | |
| 56 webrtc::MediaConstraintsInterface::kExperimentalEchoCancellation, | |
| 57 webrtc::MediaConstraintsInterface::kAutoGainControl, | |
| 58 webrtc::MediaConstraintsInterface::kExperimentalAutoGainControl, | |
| 59 webrtc::MediaConstraintsInterface::kNoiseSuppression, | |
| 60 webrtc::MediaConstraintsInterface::kHighpassFilter, | |
| 61 webrtc::MediaConstraintsInterface::kTypingNoiseDetection, | |
| 62 webrtc::MediaConstraintsInterface::kExperimentalNoiseSuppression | |
| 63 }; | |
| 64 MockMediaConstraintFactory factory; | |
|
perkj_chrome
2014/03/12 06:55:07
unused
| |
| 65 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) { | |
| 66 AddMandatory(kDefaultAudioConstraints[i], false); | |
| 67 } | |
| 68 } | |
| 69 | |
| 70 } // namespace content | |
| OLD | NEW |