OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 using webrtc::LocalAudioSource; | 39 using webrtc::LocalAudioSource; |
40 using webrtc::MediaConstraintsInterface; | 40 using webrtc::MediaConstraintsInterface; |
41 using webrtc::MediaSourceInterface; | 41 using webrtc::MediaSourceInterface; |
42 using webrtc::PeerConnectionFactoryInterface; | 42 using webrtc::PeerConnectionFactoryInterface; |
43 | 43 |
44 TEST(LocalAudioSourceTest, SetValidOptions) { | 44 TEST(LocalAudioSourceTest, SetValidOptions) { |
45 webrtc::FakeConstraints constraints; | 45 webrtc::FakeConstraints constraints; |
46 constraints.AddMandatory(MediaConstraintsInterface::kEchoCancellation, false); | 46 constraints.AddMandatory(MediaConstraintsInterface::kEchoCancellation, false); |
47 constraints.AddOptional( | 47 constraints.AddOptional( |
48 MediaConstraintsInterface::kExperimentalEchoCancellation, true); | 48 MediaConstraintsInterface::kExtendedFilterEchoCancellation, true); |
49 constraints.AddOptional(MediaConstraintsInterface::kDAEchoCancellation, true); | 49 constraints.AddOptional(MediaConstraintsInterface::kDAEchoCancellation, true); |
50 constraints.AddOptional(MediaConstraintsInterface::kAutoGainControl, true); | 50 constraints.AddOptional(MediaConstraintsInterface::kAutoGainControl, true); |
51 constraints.AddOptional( | 51 constraints.AddOptional( |
52 MediaConstraintsInterface::kExperimentalAutoGainControl, true); | 52 MediaConstraintsInterface::kExperimentalAutoGainControl, true); |
53 constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false); | 53 constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false); |
54 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true); | 54 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true); |
55 constraints.AddOptional(MediaConstraintsInterface::kAecDump, true); | 55 constraints.AddOptional(MediaConstraintsInterface::kAecDump, true); |
56 | 56 |
57 rtc::scoped_refptr<LocalAudioSource> source = | 57 rtc::scoped_refptr<LocalAudioSource> source = |
58 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), | 58 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), |
59 &constraints); | 59 &constraints); |
60 | 60 |
61 bool value; | 61 bool value; |
62 EXPECT_TRUE(source->options().echo_cancellation.Get(&value)); | 62 EXPECT_TRUE(source->options().echo_cancellation.Get(&value)); |
63 EXPECT_FALSE(value); | 63 EXPECT_FALSE(value); |
64 EXPECT_TRUE(source->options().experimental_aec.Get(&value)); | 64 EXPECT_TRUE(source->options().extended_filter_aec.Get(&value)); |
65 EXPECT_TRUE(value); | 65 EXPECT_TRUE(value); |
66 EXPECT_TRUE(source->options().delay_agnostic_aec.Get(&value)); | 66 EXPECT_TRUE(source->options().delay_agnostic_aec.Get(&value)); |
67 EXPECT_TRUE(value); | 67 EXPECT_TRUE(value); |
68 EXPECT_TRUE(source->options().auto_gain_control.Get(&value)); | 68 EXPECT_TRUE(source->options().auto_gain_control.Get(&value)); |
69 EXPECT_TRUE(value); | 69 EXPECT_TRUE(value); |
70 EXPECT_TRUE(source->options().experimental_agc.Get(&value)); | 70 EXPECT_TRUE(source->options().experimental_agc.Get(&value)); |
71 EXPECT_TRUE(value); | 71 EXPECT_TRUE(value); |
72 EXPECT_TRUE(source->options().noise_suppression.Get(&value)); | 72 EXPECT_TRUE(source->options().noise_suppression.Get(&value)); |
73 EXPECT_FALSE(value); | 73 EXPECT_FALSE(value); |
74 EXPECT_TRUE(source->options().highpass_filter.Get(&value)); | 74 EXPECT_TRUE(source->options().highpass_filter.Get(&value)); |
75 EXPECT_TRUE(value); | 75 EXPECT_TRUE(value); |
76 EXPECT_TRUE(source->options().aec_dump.Get(&value)); | 76 EXPECT_TRUE(source->options().aec_dump.Get(&value)); |
77 EXPECT_TRUE(value); | 77 EXPECT_TRUE(value); |
78 } | 78 } |
79 | 79 |
| 80 // TODO(henrik.lundin) Remove SetExtendedFilterEchoCancellationOff test. |
| 81 // https://code.google.com/p/webrtc/issues/detail?id=4696 |
| 82 TEST(LocalAudioSourceTest, SetExtendedFilterEchoCancellationOff) { |
| 83 webrtc::FakeConstraints constraints; |
| 84 constraints.AddOptional( |
| 85 MediaConstraintsInterface::kExtendedFilterEchoCancellation, false); |
| 86 |
| 87 rtc::scoped_refptr<LocalAudioSource> source = LocalAudioSource::Create( |
| 88 PeerConnectionFactoryInterface::Options(), &constraints); |
| 89 |
| 90 bool value; |
| 91 EXPECT_TRUE(source->options().extended_filter_aec.Get(&value)); |
| 92 EXPECT_FALSE(value); |
| 93 } |
| 94 |
| 95 // TODO(henrik.lundin) Remove SetExperimentalEchoCancellationOn test. |
| 96 // https://code.google.com/p/webrtc/issues/detail?id=4696 |
| 97 TEST(LocalAudioSourceTest, SetExperimentalEchoCancellationOn) { |
| 98 webrtc::FakeConstraints constraints; |
| 99 constraints.AddOptional( |
| 100 MediaConstraintsInterface::kExperimentalEchoCancellation, true); |
| 101 |
| 102 rtc::scoped_refptr<LocalAudioSource> source = LocalAudioSource::Create( |
| 103 PeerConnectionFactoryInterface::Options(), &constraints); |
| 104 |
| 105 bool value; |
| 106 EXPECT_TRUE(source->options().extended_filter_aec.Get(&value)); |
| 107 EXPECT_TRUE(value); |
| 108 } |
| 109 |
| 110 // TODO(henrik.lundin) Remove SetExperimentalEchoCancellationOff test. |
| 111 // https://code.google.com/p/webrtc/issues/detail?id=4696 |
| 112 TEST(LocalAudioSourceTest, SetExperimentalEchoCancellationOff) { |
| 113 webrtc::FakeConstraints constraints; |
| 114 constraints.AddOptional( |
| 115 MediaConstraintsInterface::kExperimentalEchoCancellation, false); |
| 116 |
| 117 rtc::scoped_refptr<LocalAudioSource> source = LocalAudioSource::Create( |
| 118 PeerConnectionFactoryInterface::Options(), &constraints); |
| 119 |
| 120 bool value; |
| 121 EXPECT_TRUE(source->options().extended_filter_aec.Get(&value)); |
| 122 EXPECT_FALSE(value); |
| 123 } |
| 124 |
80 TEST(LocalAudioSourceTest, OptionNotSet) { | 125 TEST(LocalAudioSourceTest, OptionNotSet) { |
81 webrtc::FakeConstraints constraints; | 126 webrtc::FakeConstraints constraints; |
82 rtc::scoped_refptr<LocalAudioSource> source = | 127 rtc::scoped_refptr<LocalAudioSource> source = |
83 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), | 128 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), |
84 &constraints); | 129 &constraints); |
85 bool value; | 130 bool value; |
86 EXPECT_FALSE(source->options().highpass_filter.Get(&value)); | 131 EXPECT_FALSE(source->options().highpass_filter.Get(&value)); |
87 } | 132 } |
88 | 133 |
89 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) { | 134 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 167 |
123 rtc::scoped_refptr<LocalAudioSource> source = | 168 rtc::scoped_refptr<LocalAudioSource> source = |
124 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), | 169 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), |
125 &constraints); | 170 &constraints); |
126 | 171 |
127 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); | 172 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); |
128 bool value; | 173 bool value; |
129 EXPECT_TRUE(source->options().highpass_filter.Get(&value)); | 174 EXPECT_TRUE(source->options().highpass_filter.Get(&value)); |
130 EXPECT_FALSE(value); | 175 EXPECT_FALSE(value); |
131 } | 176 } |
OLD | NEW |