OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 max_encoding_bandwidth(0), | 181 max_encoding_bandwidth(0), |
182 opus_dtx(false), | 182 opus_dtx(false), |
183 red(false), | 183 red(false), |
184 nack(false), | 184 nack(false), |
185 cn8_type(13), | 185 cn8_type(13), |
186 cn16_type(105), | 186 cn16_type(105), |
187 dtmf_type(106), | 187 dtmf_type(106), |
188 red_type(117), | 188 red_type(117), |
189 nack_max_packets(0), | 189 nack_max_packets(0), |
190 send_ssrc(0), | 190 send_ssrc(0), |
191 send_audio_level_ext_(-1), | |
192 receive_audio_level_ext_(-1), | 191 receive_audio_level_ext_(-1), |
193 send_absolute_sender_time_ext_(-1), | |
194 receive_absolute_sender_time_ext_(-1), | 192 receive_absolute_sender_time_ext_(-1), |
195 associate_send_channel(-1), | 193 associate_send_channel(-1), |
196 neteq_capacity(-1), | 194 neteq_capacity(-1), |
197 neteq_fast_accelerate(false) { | 195 neteq_fast_accelerate(false) { |
198 memset(&send_codec, 0, sizeof(send_codec)); | 196 memset(&send_codec, 0, sizeof(send_codec)); |
199 } | 197 } |
200 bool external_transport; | 198 bool external_transport; |
201 bool send; | 199 bool send; |
202 bool playout; | 200 bool playout; |
203 float volume_scale; | 201 float volume_scale; |
204 bool vad; | 202 bool vad; |
205 bool codec_fec; | 203 bool codec_fec; |
206 int max_encoding_bandwidth; | 204 int max_encoding_bandwidth; |
207 bool opus_dtx; | 205 bool opus_dtx; |
208 bool red; | 206 bool red; |
209 bool nack; | 207 bool nack; |
210 int cn8_type; | 208 int cn8_type; |
211 int cn16_type; | 209 int cn16_type; |
212 int dtmf_type; | 210 int dtmf_type; |
213 int red_type; | 211 int red_type; |
214 int nack_max_packets; | 212 int nack_max_packets; |
215 uint32_t send_ssrc; | 213 uint32_t send_ssrc; |
216 int send_audio_level_ext_; | |
217 int receive_audio_level_ext_; | 214 int receive_audio_level_ext_; |
218 int send_absolute_sender_time_ext_; | |
219 int receive_absolute_sender_time_ext_; | 215 int receive_absolute_sender_time_ext_; |
220 int associate_send_channel; | 216 int associate_send_channel; |
221 DtmfInfo dtmf_info; | 217 DtmfInfo dtmf_info; |
222 std::vector<webrtc::CodecInst> recv_codecs; | 218 std::vector<webrtc::CodecInst> recv_codecs; |
223 webrtc::CodecInst send_codec; | 219 webrtc::CodecInst send_codec; |
224 webrtc::PacketTime last_rtp_packet_time; | 220 webrtc::PacketTime last_rtp_packet_time; |
225 std::list<std::string> packets; | 221 std::list<std::string> packets; |
226 int neteq_capacity; | 222 int neteq_capacity; |
227 bool neteq_fast_accelerate; | 223 bool neteq_fast_accelerate; |
228 }; | 224 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 for (std::map<int, Channel*>::const_iterator i = channels_.begin(); | 256 for (std::map<int, Channel*>::const_iterator i = channels_.begin(); |
261 i != channels_.end(); ++i) { | 257 i != channels_.end(); ++i) { |
262 delete i->second; | 258 delete i->second; |
263 } | 259 } |
264 } | 260 } |
265 | 261 |
266 bool ec_metrics_enabled() const { return ec_metrics_enabled_; } | 262 bool ec_metrics_enabled() const { return ec_metrics_enabled_; } |
267 | 263 |
268 bool IsInited() const { return inited_; } | 264 bool IsInited() const { return inited_; } |
269 int GetLastChannel() const { return last_channel_; } | 265 int GetLastChannel() const { return last_channel_; } |
270 int GetChannelFromLocalSsrc(uint32_t local_ssrc) const { | |
271 for (std::map<int, Channel*>::const_iterator iter = channels_.begin(); | |
272 iter != channels_.end(); ++iter) { | |
273 if (local_ssrc == iter->second->send_ssrc) | |
274 return iter->first; | |
275 } | |
276 return -1; | |
277 } | |
278 int GetNumChannels() const { return static_cast<int>(channels_.size()); } | 266 int GetNumChannels() const { return static_cast<int>(channels_.size()); } |
279 uint32_t GetLocalSSRC(int channel) { | 267 uint32_t GetLocalSSRC(int channel) { |
280 return channels_[channel]->send_ssrc; | 268 return channels_[channel]->send_ssrc; |
281 } | 269 } |
282 bool GetPlayout(int channel) { | 270 bool GetPlayout(int channel) { |
283 return channels_[channel]->playout; | 271 return channels_[channel]->playout; |
284 } | 272 } |
285 bool GetSend(int channel) { | 273 bool GetSend(int channel) { |
286 return channels_[channel]->send; | 274 return channels_[channel]->send; |
287 } | 275 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 ch->recv_codecs.push_back(codec); | 345 ch->recv_codecs.push_back(codec); |
358 } | 346 } |
359 if (config.Get<webrtc::NetEqCapacityConfig>().enabled) { | 347 if (config.Get<webrtc::NetEqCapacityConfig>().enabled) { |
360 ch->neteq_capacity = config.Get<webrtc::NetEqCapacityConfig>().capacity; | 348 ch->neteq_capacity = config.Get<webrtc::NetEqCapacityConfig>().capacity; |
361 } | 349 } |
362 ch->neteq_fast_accelerate = | 350 ch->neteq_fast_accelerate = |
363 config.Get<webrtc::NetEqFastAccelerate>().enabled; | 351 config.Get<webrtc::NetEqFastAccelerate>().enabled; |
364 channels_[++last_channel_] = ch; | 352 channels_[++last_channel_] = ch; |
365 return last_channel_; | 353 return last_channel_; |
366 } | 354 } |
367 int GetSendRtpExtensionId(int channel, const std::string& extension) { | |
368 WEBRTC_ASSERT_CHANNEL(channel); | |
369 if (extension == kRtpAudioLevelHeaderExtension) { | |
370 return channels_[channel]->send_audio_level_ext_; | |
371 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) { | |
372 return channels_[channel]->send_absolute_sender_time_ext_; | |
373 } | |
374 return -1; | |
375 } | |
376 int GetReceiveRtpExtensionId(int channel, const std::string& extension) { | 355 int GetReceiveRtpExtensionId(int channel, const std::string& extension) { |
377 WEBRTC_ASSERT_CHANNEL(channel); | 356 WEBRTC_ASSERT_CHANNEL(channel); |
378 if (extension == kRtpAudioLevelHeaderExtension) { | 357 if (extension == kRtpAudioLevelHeaderExtension) { |
379 return channels_[channel]->receive_audio_level_ext_; | 358 return channels_[channel]->receive_audio_level_ext_; |
380 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) { | 359 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) { |
381 return channels_[channel]->receive_absolute_sender_time_ext_; | 360 return channels_[channel]->receive_absolute_sender_time_ext_; |
382 } | 361 } |
383 return -1; | 362 return -1; |
384 } | 363 } |
385 | 364 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 size_t length)); | 701 size_t length)); |
723 | 702 |
724 // webrtc::VoERTP_RTCP | 703 // webrtc::VoERTP_RTCP |
725 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { | 704 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { |
726 WEBRTC_CHECK_CHANNEL(channel); | 705 WEBRTC_CHECK_CHANNEL(channel); |
727 channels_[channel]->send_ssrc = ssrc; | 706 channels_[channel]->send_ssrc = ssrc; |
728 return 0; | 707 return 0; |
729 } | 708 } |
730 WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc)); | 709 WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc)); |
731 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); | 710 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); |
732 WEBRTC_FUNC(SetSendAudioLevelIndicationStatus, (int channel, bool enable, | 711 WEBRTC_STUB(SetSendAudioLevelIndicationStatus, (int channel, bool enable, |
733 unsigned char id)) { | 712 unsigned char id)); |
734 WEBRTC_CHECK_CHANNEL(channel); | |
735 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); | |
736 channels_[channel]->send_audio_level_ext_ = (enable) ? id : -1; | |
737 return 0; | |
738 } | |
739 WEBRTC_FUNC(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable, | 713 WEBRTC_FUNC(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable, |
740 unsigned char id)) { | 714 unsigned char id)) { |
741 WEBRTC_CHECK_CHANNEL(channel); | 715 WEBRTC_CHECK_CHANNEL(channel); |
742 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); | 716 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); |
743 channels_[channel]->receive_audio_level_ext_ = (enable) ? id : -1; | 717 channels_[channel]->receive_audio_level_ext_ = (enable) ? id : -1; |
744 return 0; | 718 return 0; |
745 } | 719 } |
746 WEBRTC_FUNC(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable, | 720 WEBRTC_STUB(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable, |
747 unsigned char id)) { | 721 unsigned char id)); |
748 WEBRTC_CHECK_CHANNEL(channel); | |
749 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); | |
750 channels_[channel]->send_absolute_sender_time_ext_ = (enable) ? id : -1; | |
751 return 0; | |
752 } | |
753 WEBRTC_FUNC(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable, | 722 WEBRTC_FUNC(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable, |
754 unsigned char id)) { | 723 unsigned char id)) { |
755 WEBRTC_CHECK_CHANNEL(channel); | 724 WEBRTC_CHECK_CHANNEL(channel); |
756 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); | 725 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id); |
757 channels_[channel]->receive_absolute_sender_time_ext_ = (enable) ? id : -1; | 726 channels_[channel]->receive_absolute_sender_time_ext_ = (enable) ? id : -1; |
758 return 0; | 727 return 0; |
759 } | 728 } |
760 | 729 |
761 WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable)); | 730 WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable)); |
762 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled)); | 731 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled)); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 int playout_sample_rate_; | 979 int playout_sample_rate_; |
1011 DtmfInfo dtmf_info_; | 980 DtmfInfo dtmf_info_; |
1012 FakeAudioProcessing audio_processing_; | 981 FakeAudioProcessing audio_processing_; |
1013 }; | 982 }; |
1014 | 983 |
1015 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID | 984 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID |
1016 | 985 |
1017 } // namespace cricket | 986 } // namespace cricket |
1018 | 987 |
1019 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ | 988 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |