OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 "Channel::SendData() failed to send data to RTP/RTCP module"); | 439 "Channel::SendData() failed to send data to RTP/RTCP module"); |
440 return -1; | 440 return -1; |
441 } | 441 } |
442 | 442 |
443 _lastLocalTimeStamp = timeStamp; | 443 _lastLocalTimeStamp = timeStamp; |
444 _lastPayloadType = payloadType; | 444 _lastPayloadType = payloadType; |
445 | 445 |
446 return 0; | 446 return 0; |
447 } | 447 } |
448 | 448 |
449 int32_t Channel::InFrameType(FrameType frame_type) { | |
450 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
451 "Channel::InFrameType(frame_type=%d)", frame_type); | |
452 | |
453 rtc::CritScope cs(&_callbackCritSect); | |
454 _sendFrameType = (frame_type == kAudioFrameSpeech); | |
455 return 0; | |
456 } | |
457 | |
458 bool Channel::SendRtp(const uint8_t* data, | 449 bool Channel::SendRtp(const uint8_t* data, |
459 size_t len, | 450 size_t len, |
460 const PacketOptions& options) { | 451 const PacketOptions& options) { |
461 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), | 452 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
462 "Channel::SendPacket(channel=%d, len=%" PRIuS ")", len); | 453 "Channel::SendPacket(channel=%d, len=%" PRIuS ")", len); |
463 | 454 |
464 rtc::CritScope cs(&_callbackCritSect); | 455 rtc::CritScope cs(&_callbackCritSect); |
465 | 456 |
466 if (_transportPtr == NULL) { | 457 if (_transportPtr == NULL) { |
467 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | 458 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), | 877 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), |
887 capture_start_rtp_time_stamp_(-1), | 878 capture_start_rtp_time_stamp_(-1), |
888 capture_start_ntp_time_ms_(-1), | 879 capture_start_ntp_time_ms_(-1), |
889 _engineStatisticsPtr(NULL), | 880 _engineStatisticsPtr(NULL), |
890 _outputMixerPtr(NULL), | 881 _outputMixerPtr(NULL), |
891 _moduleProcessThreadPtr(NULL), | 882 _moduleProcessThreadPtr(NULL), |
892 _audioDeviceModulePtr(NULL), | 883 _audioDeviceModulePtr(NULL), |
893 _voiceEngineObserverPtr(NULL), | 884 _voiceEngineObserverPtr(NULL), |
894 _callbackCritSectPtr(NULL), | 885 _callbackCritSectPtr(NULL), |
895 _transportPtr(NULL), | 886 _transportPtr(NULL), |
896 _sendFrameType(0), | |
897 input_mute_(false), | 887 input_mute_(false), |
898 previous_frame_muted_(false), | 888 previous_frame_muted_(false), |
899 _outputGain(1.0f), | 889 _outputGain(1.0f), |
900 _mixFileWithMicrophone(false), | 890 _mixFileWithMicrophone(false), |
901 _lastLocalTimeStamp(0), | 891 _lastLocalTimeStamp(0), |
902 _lastPayloadType(0), | 892 _lastPayloadType(0), |
903 _includeAudioLevelIndication(false), | 893 _includeAudioLevelIndication(false), |
904 transport_overhead_per_packet_(0), | 894 transport_overhead_per_packet_(0), |
905 rtp_overhead_per_packet_(0), | 895 rtp_overhead_per_packet_(0), |
906 _outputSpeechType(AudioFrame::kNormalSpeech), | 896 _outputSpeechType(AudioFrame::kNormalSpeech), |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 | 1009 |
1020 // Ensure that RTCP is enabled by default for the created channel. | 1010 // Ensure that RTCP is enabled by default for the created channel. |
1021 // Note that, the module will keep generating RTCP until it is explicitly | 1011 // Note that, the module will keep generating RTCP until it is explicitly |
1022 // disabled by the user. | 1012 // disabled by the user. |
1023 // After StopListen (when no sockets exists), RTCP packets will no longer | 1013 // After StopListen (when no sockets exists), RTCP packets will no longer |
1024 // be transmitted since the Transport object will then be invalid. | 1014 // be transmitted since the Transport object will then be invalid. |
1025 telephone_event_handler_->SetTelephoneEventForwardToDecoder(true); | 1015 telephone_event_handler_->SetTelephoneEventForwardToDecoder(true); |
1026 // RTCP is enabled by default. | 1016 // RTCP is enabled by default. |
1027 _rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound); | 1017 _rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound); |
1028 // --- Register all permanent callbacks | 1018 // --- Register all permanent callbacks |
1029 const bool fail = (audio_coding_->RegisterTransportCallback(this) == -1) || | 1019 if (audio_coding_->RegisterTransportCallback(this) == -1) { |
1030 (audio_coding_->RegisterVADCallback(this) == -1); | |
1031 | |
1032 if (fail) { | |
1033 _engineStatisticsPtr->SetLastError( | 1020 _engineStatisticsPtr->SetLastError( |
1034 VE_CANNOT_INIT_CHANNEL, kTraceError, | 1021 VE_CANNOT_INIT_CHANNEL, kTraceError, |
1035 "Channel::Init() callbacks not registered"); | 1022 "Channel::Init() callbacks not registered"); |
1036 return -1; | 1023 return -1; |
1037 } | 1024 } |
1038 | 1025 |
1039 // --- Register all supported codecs to the receiving side of the | 1026 // --- Register all supported codecs to the receiving side of the |
1040 // RTP/RTCP module | 1027 // RTP/RTCP module |
1041 | 1028 |
1042 CodecInst codec; | 1029 CodecInst codec; |
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 _engineStatisticsPtr->SetLastError( | 2274 _engineStatisticsPtr->SetLastError( |
2288 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 2275 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
2289 "SetSendTelephoneEventPayloadType() failed to register send" | 2276 "SetSendTelephoneEventPayloadType() failed to register send" |
2290 "payload type"); | 2277 "payload type"); |
2291 return -1; | 2278 return -1; |
2292 } | 2279 } |
2293 } | 2280 } |
2294 return 0; | 2281 return 0; |
2295 } | 2282 } |
2296 | 2283 |
2297 int Channel::VoiceActivityIndicator(int& activity) { | |
2298 activity = _sendFrameType; | |
2299 return 0; | |
2300 } | |
2301 | |
2302 int Channel::SetLocalSSRC(unsigned int ssrc) { | 2284 int Channel::SetLocalSSRC(unsigned int ssrc) { |
2303 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2285 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
2304 "Channel::SetLocalSSRC()"); | 2286 "Channel::SetLocalSSRC()"); |
2305 if (channel_state_.Get().sending) { | 2287 if (channel_state_.Get().sending) { |
2306 _engineStatisticsPtr->SetLastError(VE_ALREADY_SENDING, kTraceError, | 2288 _engineStatisticsPtr->SetLastError(VE_ALREADY_SENDING, kTraceError, |
2307 "SetLocalSSRC() already sending"); | 2289 "SetLocalSSRC() already sending"); |
2308 return -1; | 2290 return -1; |
2309 } | 2291 } |
2310 _rtpRtcpModule->SetSSRC(ssrc); | 2292 _rtpRtcpModule->SetSSRC(ssrc); |
2311 return 0; | 2293 return 0; |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3010 int64_t min_rtt = 0; | 2992 int64_t min_rtt = 0; |
3011 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 2993 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3012 0) { | 2994 0) { |
3013 return 0; | 2995 return 0; |
3014 } | 2996 } |
3015 return rtt; | 2997 return rtt; |
3016 } | 2998 } |
3017 | 2999 |
3018 } // namespace voe | 3000 } // namespace voe |
3019 } // namespace webrtc | 3001 } // namespace webrtc |
OLD | NEW |