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

Side by Side Diff: content/renderer/media/mock_media_constraint_factory.cc

Issue 190643003: Fix/Add content_unittests to work for the code behind --enable-audio-track-processing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed an empty line. Created 6 years, 9 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
OLDNEW
(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;
65 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) {
66 AddMandatory(kDefaultAudioConstraints[i], false);
67 }
68 }
69
70 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_constraint_factory.h ('k') | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698