OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 11 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
12 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 12 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/base/basictypes.h" | 18 #include "webrtc/base/basictypes.h" |
19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/stringutils.h" | 20 #include "webrtc/base/stringutils.h" |
21 #include "webrtc/config.h" | 21 #include "webrtc/config.h" |
22 #include "webrtc/media/base/codec.h" | 22 #include "webrtc/media/base/codec.h" |
23 #include "webrtc/media/base/rtputils.h" | 23 #include "webrtc/media/base/rtputils.h" |
24 #include "webrtc/media/engine/webrtcvoe.h" | 24 #include "webrtc/media/engine/webrtcvoe.h" |
25 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" | 25 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
| 26 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" |
26 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 27 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
27 | 28 |
28 namespace cricket { | 29 namespace cricket { |
29 | 30 |
30 static const int kOpusBandwidthNb = 4000; | 31 static const int kOpusBandwidthNb = 4000; |
31 static const int kOpusBandwidthMb = 6000; | 32 static const int kOpusBandwidthMb = 6000; |
32 static const int kOpusBandwidthWb = 8000; | 33 static const int kOpusBandwidthWb = 8000; |
33 static const int kOpusBandwidthSwb = 12000; | 34 static const int kOpusBandwidthSwb = 12000; |
34 static const int kOpusBandwidthFb = 20000; | 35 static const int kOpusBandwidthFb = 20000; |
35 | 36 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 138 |
138 // webrtc::VoECodec | 139 // webrtc::VoECodec |
139 WEBRTC_STUB(NumOfCodecs, ()); | 140 WEBRTC_STUB(NumOfCodecs, ()); |
140 WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec)); | 141 WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec)); |
141 WEBRTC_STUB(SetSendCodec, (int channel, const webrtc::CodecInst& codec)); | 142 WEBRTC_STUB(SetSendCodec, (int channel, const webrtc::CodecInst& codec)); |
142 WEBRTC_STUB(GetSendCodec, (int channel, webrtc::CodecInst& codec)); | 143 WEBRTC_STUB(GetSendCodec, (int channel, webrtc::CodecInst& codec)); |
143 WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps)); | 144 WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps)); |
144 WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec)); | 145 WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec)); |
145 WEBRTC_FUNC(SetRecPayloadType, (int channel, | 146 WEBRTC_FUNC(SetRecPayloadType, (int channel, |
146 const webrtc::CodecInst& codec)) { | 147 const webrtc::CodecInst& codec)) { |
| 148 return SetRecPayloadType(channel, codec.pltype, CodecInstToSdp(codec)); |
| 149 } |
| 150 WEBRTC_FUNC(SetRecPayloadType, |
| 151 (int channel, |
| 152 int payload_type, |
| 153 const webrtc::SdpAudioFormat& format)) { |
147 WEBRTC_CHECK_CHANNEL(channel); | 154 WEBRTC_CHECK_CHANNEL(channel); |
148 Channel* ch = channels_[channel]; | 155 Channel* ch = channels_[channel]; |
149 // Check if something else already has this slot. | 156 // Check if something else already has this slot. |
150 if (codec.pltype != -1) { | 157 if (payload_type != -1) { |
151 for (std::vector<webrtc::CodecInst>::iterator it = | 158 for (std::vector<webrtc::CodecInst>::iterator it = |
152 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) { | 159 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) { |
153 if (it->pltype == codec.pltype && | 160 if (it->pltype == payload_type && |
154 _stricmp(it->plname, codec.plname) != 0) { | 161 _stricmp(it->plname, format.name.c_str()) != 0) { |
155 return -1; | 162 return -1; |
156 } | 163 } |
157 } | 164 } |
158 } | 165 } |
159 // Otherwise try to find this codec and update its payload type. | 166 // Otherwise try to find this codec and update its payload type. |
160 int result = -1; // not found | 167 int result = -1; // not found |
161 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin(); | 168 for (auto& codec : ch->recv_codecs) { |
162 it != ch->recv_codecs.end(); ++it) { | 169 if (CodecInstToSdp(codec) == format) { |
163 if (strcmp(it->plname, codec.plname) == 0 && | 170 codec.pltype = payload_type; |
164 it->plfreq == codec.plfreq && | |
165 it->channels == codec.channels) { | |
166 it->pltype = codec.pltype; | |
167 result = 0; | 171 result = 0; |
168 } | 172 } |
169 } | 173 } |
170 return result; | 174 return result; |
171 } | 175 } |
172 WEBRTC_STUB(SetSendCNPayloadType, (int channel, int type, | 176 WEBRTC_STUB(SetSendCNPayloadType, (int channel, int type, |
173 webrtc::PayloadFrequencies frequency)); | 177 webrtc::PayloadFrequencies frequency)); |
174 WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) { | 178 WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) { |
175 WEBRTC_CHECK_CHANNEL(channel); | 179 WEBRTC_CHECK_CHANNEL(channel); |
176 Channel* ch = channels_[channel]; | 180 Channel* ch = channels_[channel]; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; | 357 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; |
354 webrtc::AgcConfig agc_config_; | 358 webrtc::AgcConfig agc_config_; |
355 webrtc::AudioProcessing* apm_ = nullptr; | 359 webrtc::AudioProcessing* apm_ = nullptr; |
356 | 360 |
357 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine); | 361 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine); |
358 }; | 362 }; |
359 | 363 |
360 } // namespace cricket | 364 } // namespace cricket |
361 | 365 |
362 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 366 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |