Chromium Code Reviews| 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 |
| 11 #include "webrtc/voice_engine/channel.h" | 11 #include "webrtc/voice_engine/channel.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/base/format_macros.h" | 16 #include "webrtc/base/format_macros.h" |
| 17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 18 #include "webrtc/base/timeutils.h" | 18 #include "webrtc/base/timeutils.h" |
| 19 #include "webrtc/common.h" | 19 #include "webrtc/common.h" |
| 20 #include "webrtc/config.h" | 20 #include "webrtc/config.h" |
| 21 #include "webrtc/modules/audio_device/include/audio_device.h" | 21 #include "webrtc/modules/audio_device/include/audio_device.h" |
| 22 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 22 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 23 #include "webrtc/modules/include/module_common_types.h" | 23 #include "webrtc/modules/include/module_common_types.h" |
| 24 #include "webrtc/modules/pacing/paced_sender.h" | |
| 24 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 25 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
| 26 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" |
| 28 #include "webrtc/modules/utility/include/audio_frame_operations.h" | 29 #include "webrtc/modules/utility/include/audio_frame_operations.h" |
| 29 #include "webrtc/modules/utility/include/process_thread.h" | 30 #include "webrtc/modules/utility/include/process_thread.h" |
| 30 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 31 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 31 #include "webrtc/system_wrappers/include/trace.h" | 32 #include "webrtc/system_wrappers/include/trace.h" |
| 32 #include "webrtc/voice_engine/include/voe_base.h" | 33 #include "webrtc/voice_engine/include/voe_base.h" |
| 33 #include "webrtc/voice_engine/include/voe_external_media.h" | 34 #include "webrtc/voice_engine/include/voe_external_media.h" |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, | 684 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, |
| 684 VoEId(_instanceId,_channelId), | 685 VoEId(_instanceId,_channelId), |
| 685 "Channel::RecordFileEnded() => output file recorder module is" | 686 "Channel::RecordFileEnded() => output file recorder module is" |
| 686 " shutdown"); | 687 " shutdown"); |
| 687 } | 688 } |
| 688 | 689 |
| 689 Channel::Channel(int32_t channelId, | 690 Channel::Channel(int32_t channelId, |
| 690 uint32_t instanceId, | 691 uint32_t instanceId, |
| 691 RtcEventLog* const event_log, | 692 RtcEventLog* const event_log, |
| 692 const Config& config) | 693 const Config& config) |
| 693 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 694 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |
| 694 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 695 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |
| 695 volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()), | 696 volume_settings_critsect_( |
| 696 _instanceId(instanceId), | 697 *CriticalSectionWrapper::CreateCriticalSection()), |
| 697 _channelId(channelId), | 698 _instanceId(instanceId), |
| 698 event_log_(event_log), | 699 _channelId(channelId), |
| 699 rtp_header_parser_(RtpHeaderParser::Create()), | 700 event_log_(event_log), |
| 700 rtp_payload_registry_( | 701 rtp_header_parser_(RtpHeaderParser::Create()), |
| 701 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), | 702 rtp_payload_registry_( |
| 702 rtp_receive_statistics_( | 703 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), |
| 703 ReceiveStatistics::Create(Clock::GetRealTimeClock())), | 704 rtp_receive_statistics_( |
| 704 rtp_receiver_( | 705 ReceiveStatistics::Create(Clock::GetRealTimeClock())), |
| 705 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), | 706 rtp_receiver_( |
| 706 this, | 707 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), |
| 707 this, | 708 this, |
| 708 this, | 709 this, |
| 709 rtp_payload_registry_.get())), | 710 this, |
| 710 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), | 711 rtp_payload_registry_.get())), |
| 711 _outputAudioLevel(), | 712 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), |
| 712 _externalTransport(false), | 713 _outputAudioLevel(), |
| 713 _inputFilePlayerPtr(NULL), | 714 _externalTransport(false), |
| 714 _outputFilePlayerPtr(NULL), | 715 _inputFilePlayerPtr(NULL), |
| 715 _outputFileRecorderPtr(NULL), | 716 _outputFilePlayerPtr(NULL), |
| 716 // Avoid conflict with other channels by adding 1024 - 1026, | 717 _outputFileRecorderPtr(NULL), |
| 717 // won't use as much as 1024 channels. | 718 // Avoid conflict with other channels by adding 1024 - 1026, |
| 718 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), | 719 // won't use as much as 1024 channels. |
| 719 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), | 720 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), |
| 720 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), | 721 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), |
| 721 _outputFileRecording(false), | 722 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), |
| 722 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), | 723 _outputFileRecording(false), |
| 723 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), | 724 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), |
| 724 _outputExternalMedia(false), | 725 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), |
| 725 _inputExternalMediaCallbackPtr(NULL), | 726 _outputExternalMedia(false), |
| 726 _outputExternalMediaCallbackPtr(NULL), | 727 _inputExternalMediaCallbackPtr(NULL), |
| 727 _timeStamp(0), // This is just an offset, RTP module will add it's own | 728 _outputExternalMediaCallbackPtr(NULL), |
| 728 // random offset | 729 _timeStamp(0), // This is just an offset, RTP module will add it's own |
| 729 _sendTelephoneEventPayloadType(106), | 730 // random offset |
| 730 ntp_estimator_(Clock::GetRealTimeClock()), | 731 _sendTelephoneEventPayloadType(106), |
| 731 jitter_buffer_playout_timestamp_(0), | 732 ntp_estimator_(Clock::GetRealTimeClock()), |
| 732 playout_timestamp_rtp_(0), | 733 jitter_buffer_playout_timestamp_(0), |
| 733 playout_timestamp_rtcp_(0), | 734 playout_timestamp_rtp_(0), |
| 734 playout_delay_ms_(0), | 735 playout_timestamp_rtcp_(0), |
| 735 _numberOfDiscardedPackets(0), | 736 playout_delay_ms_(0), |
| 736 send_sequence_number_(0), | 737 _numberOfDiscardedPackets(0), |
| 737 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 738 send_sequence_number_(0), |
| 738 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), | 739 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 739 capture_start_rtp_time_stamp_(-1), | 740 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), |
| 740 capture_start_ntp_time_ms_(-1), | 741 capture_start_rtp_time_stamp_(-1), |
| 741 _engineStatisticsPtr(NULL), | 742 capture_start_ntp_time_ms_(-1), |
| 742 _outputMixerPtr(NULL), | 743 _engineStatisticsPtr(NULL), |
| 743 _transmitMixerPtr(NULL), | 744 _outputMixerPtr(NULL), |
| 744 _moduleProcessThreadPtr(NULL), | 745 _transmitMixerPtr(NULL), |
| 745 _audioDeviceModulePtr(NULL), | 746 _moduleProcessThreadPtr(NULL), |
| 746 _voiceEngineObserverPtr(NULL), | 747 _audioDeviceModulePtr(NULL), |
| 747 _callbackCritSectPtr(NULL), | 748 _voiceEngineObserverPtr(NULL), |
| 748 _transportPtr(NULL), | 749 _callbackCritSectPtr(NULL), |
| 749 _rxVadObserverPtr(NULL), | 750 _transportPtr(NULL), |
| 750 _oldVadDecision(-1), | 751 _rxVadObserverPtr(NULL), |
| 751 _sendFrameType(0), | 752 _oldVadDecision(-1), |
| 752 _externalMixing(false), | 753 _sendFrameType(0), |
| 753 _mixFileWithMicrophone(false), | 754 _externalMixing(false), |
| 754 _mute(false), | 755 _mixFileWithMicrophone(false), |
| 755 _panLeft(1.0f), | 756 _mute(false), |
| 756 _panRight(1.0f), | 757 _panLeft(1.0f), |
| 757 _outputGain(1.0f), | 758 _panRight(1.0f), |
| 758 _playOutbandDtmfEvent(false), | 759 _outputGain(1.0f), |
| 759 _playInbandDtmfEvent(false), | 760 _playOutbandDtmfEvent(false), |
| 760 _lastLocalTimeStamp(0), | 761 _playInbandDtmfEvent(false), |
| 761 _lastPayloadType(0), | 762 _lastLocalTimeStamp(0), |
| 762 _includeAudioLevelIndication(false), | 763 _lastPayloadType(0), |
| 763 _outputSpeechType(AudioFrame::kNormalSpeech), | 764 _includeAudioLevelIndication(false), |
| 764 video_sync_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 765 _outputSpeechType(AudioFrame::kNormalSpeech), |
| 765 _average_jitter_buffer_delay_us(0), | 766 video_sync_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 766 _previousTimestamp(0), | 767 _average_jitter_buffer_delay_us(0), |
| 767 _recPacketDelayMs(20), | 768 _previousTimestamp(0), |
| 768 _RxVadDetection(false), | 769 _recPacketDelayMs(20), |
| 769 _rxAgcIsEnabled(false), | 770 _RxVadDetection(false), |
| 770 _rxNsIsEnabled(false), | 771 _rxAgcIsEnabled(false), |
| 771 restored_packet_in_use_(false), | 772 _rxNsIsEnabled(false), |
| 772 rtcp_observer_(new VoERtcpObserver(this)), | 773 restored_packet_in_use_(false), |
| 773 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), | 774 rtcp_observer_(new VoERtcpObserver(this)), |
| 774 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 775 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), |
| 775 associate_send_channel_(ChannelOwner(nullptr)) { | 776 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 777 associate_send_channel_(ChannelOwner(nullptr)), | |
| 778 packet_router_(nullptr) { | |
| 776 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), | 779 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), |
| 777 "Channel::Channel() - ctor"); | 780 "Channel::Channel() - ctor"); |
| 778 AudioCodingModule::Config acm_config; | 781 AudioCodingModule::Config acm_config; |
| 779 acm_config.id = VoEModuleId(instanceId, channelId); | 782 acm_config.id = VoEModuleId(instanceId, channelId); |
| 780 if (config.Get<NetEqCapacityConfig>().enabled) { | 783 if (config.Get<NetEqCapacityConfig>().enabled) { |
| 781 // Clamping the buffer capacity at 20 packets. While going lower will | 784 // Clamping the buffer capacity at 20 packets. While going lower will |
| 782 // probably work, it makes little sense. | 785 // probably work, it makes little sense. |
| 783 acm_config.neteq_config.max_packets_in_buffer = | 786 acm_config.neteq_config.max_packets_in_buffer = |
| 784 std::max(20, config.Get<NetEqCapacityConfig>().capacity); | 787 std::max(20, config.Get<NetEqCapacityConfig>().capacity); |
| 785 } | 788 } |
| 786 acm_config.neteq_config.enable_fast_accelerate = | 789 acm_config.neteq_config.enable_fast_accelerate = |
| 787 config.Get<NetEqFastAccelerate>().enabled; | 790 config.Get<NetEqFastAccelerate>().enabled; |
| 788 audio_coding_.reset(AudioCodingModule::Create(acm_config)); | 791 audio_coding_.reset(AudioCodingModule::Create(acm_config)); |
| 789 | 792 |
| 790 _inbandDtmfQueue.ResetDtmf(); | 793 _inbandDtmfQueue.ResetDtmf(); |
| 791 _inbandDtmfGenerator.Init(); | 794 _inbandDtmfGenerator.Init(); |
| 792 _outputAudioLevel.Clear(); | 795 _outputAudioLevel.Clear(); |
| 793 | 796 |
| 794 RtpRtcp::Configuration configuration; | 797 _rtpRtcpModule.reset(CreateRtpRtcp(nullptr, nullptr, nullptr)); |
| 795 configuration.audio = true; | |
| 796 configuration.outgoing_transport = this; | |
| 797 configuration.audio_messages = this; | |
| 798 configuration.receive_statistics = rtp_receive_statistics_.get(); | |
| 799 configuration.bandwidth_callback = rtcp_observer_.get(); | |
| 800 | |
| 801 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); | |
| 802 | 798 |
| 803 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); | 799 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); |
| 804 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( | 800 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( |
| 805 statistics_proxy_.get()); | 801 statistics_proxy_.get()); |
| 806 | 802 |
| 807 Config audioproc_config; | 803 Config audioproc_config; |
| 808 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); | 804 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
| 809 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config)); | 805 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config)); |
| 810 } | 806 } |
| 811 | 807 |
| 812 Channel::~Channel() | 808 Channel::~Channel() |
| 813 { | 809 { |
| 814 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL); | 810 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL); |
| 815 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), | 811 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), |
| 816 "Channel::~Channel() - dtor"); | 812 "Channel::~Channel() - dtor"); |
| 817 | 813 |
| 818 if (_outputExternalMedia) | 814 if (_outputExternalMedia) |
| 819 { | 815 { |
| 820 DeRegisterExternalMediaProcessing(kPlaybackPerChannel); | 816 DeRegisterExternalMediaProcessing(kPlaybackPerChannel); |
| 821 } | 817 } |
| 822 if (channel_state_.Get().input_external_media) | 818 if (channel_state_.Get().input_external_media) |
| 823 { | 819 { |
| 824 DeRegisterExternalMediaProcessing(kRecordingPerChannel); | 820 DeRegisterExternalMediaProcessing(kRecordingPerChannel); |
| 825 } | 821 } |
| 826 StopSend(); | 822 StopSend(); |
| 823 if (packet_router_ != nullptr) | |
|
mflodman
2015/12/03 09:24:21
I prefer 'if (packet_router)', but I'm not sure ab
stefan-webrtc
2015/12/03 10:18:27
I also prefer that actually.
the sun
2015/12/03 11:10:28
+1
| |
| 824 packet_router_->RemoveRtpModule(_rtpRtcpModule.get()); | |
| 827 StopPlayout(); | 825 StopPlayout(); |
| 828 | 826 |
| 829 { | 827 { |
| 830 CriticalSectionScoped cs(&_fileCritSect); | 828 CriticalSectionScoped cs(&_fileCritSect); |
| 831 if (_inputFilePlayerPtr) | 829 if (_inputFilePlayerPtr) |
| 832 { | 830 { |
| 833 _inputFilePlayerPtr->RegisterModuleFileCallback(NULL); | 831 _inputFilePlayerPtr->RegisterModuleFileCallback(NULL); |
| 834 _inputFilePlayerPtr->StopPlayingFile(); | 832 _inputFilePlayerPtr->StopPlayingFile(); |
| 835 FilePlayer::DestroyFilePlayer(_inputFilePlayerPtr); | 833 FilePlayer::DestroyFilePlayer(_inputFilePlayerPtr); |
| 836 _inputFilePlayerPtr = NULL; | 834 _inputFilePlayerPtr = NULL; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 _moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get()); | 871 _moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get()); |
| 874 | 872 |
| 875 // End of modules shutdown | 873 // End of modules shutdown |
| 876 | 874 |
| 877 // Delete other objects | 875 // Delete other objects |
| 878 delete &_callbackCritSect; | 876 delete &_callbackCritSect; |
| 879 delete &_fileCritSect; | 877 delete &_fileCritSect; |
| 880 delete &volume_settings_critsect_; | 878 delete &volume_settings_critsect_; |
| 881 } | 879 } |
| 882 | 880 |
| 881 RtpRtcp* Channel::CreateRtpRtcp( | |
| 882 RtpPacketSender* packet_sender, | |
| 883 TransportSequenceNumberAllocator* sequence_number_allocator, | |
| 884 TransportFeedbackObserver* transport_feedback_callback) { | |
| 885 RtpRtcp::Configuration configuration; | |
| 886 configuration.audio = true; | |
| 887 configuration.outgoing_transport = this; | |
| 888 configuration.audio_messages = this; | |
| 889 configuration.receive_statistics = rtp_receive_statistics_.get(); | |
| 890 configuration.bandwidth_callback = rtcp_observer_.get(); | |
| 891 configuration.paced_sender = packet_sender; | |
| 892 configuration.transport_sequence_number_allocator = sequence_number_allocator; | |
| 893 configuration.transport_feedback_callback = transport_feedback_callback; | |
| 894 | |
| 895 return RtpRtcp::CreateRtpRtcp(configuration); | |
| 896 } | |
| 897 | |
| 883 int32_t | 898 int32_t |
| 884 Channel::Init() | 899 Channel::Init() |
| 885 { | 900 { |
| 886 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), | 901 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), |
| 887 "Channel::Init()"); | 902 "Channel::Init()"); |
| 888 | 903 |
| 889 channel_state_.Reset(); | 904 channel_state_.Reset(); |
| 890 | 905 |
| 891 // --- Initial sanity | 906 // --- Initial sanity |
| 892 | 907 |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2777 int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) { | 2792 int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) { |
| 2778 rtp_header_parser_->DeregisterRtpHeaderExtension( | 2793 rtp_header_parser_->DeregisterRtpHeaderExtension( |
| 2779 kRtpExtensionAbsoluteSendTime); | 2794 kRtpExtensionAbsoluteSendTime); |
| 2780 if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension( | 2795 if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension( |
| 2781 kRtpExtensionAbsoluteSendTime, id)) { | 2796 kRtpExtensionAbsoluteSendTime, id)) { |
| 2782 return -1; | 2797 return -1; |
| 2783 } | 2798 } |
| 2784 return 0; | 2799 return 0; |
| 2785 } | 2800 } |
| 2786 | 2801 |
| 2802 void Channel::SetSendTransportSequenceNumber(int id) { | |
|
mflodman
2015/12/03 09:24:21
This is a bit ambiguous, might be interpreted as s
stefan-webrtc
2015/12/03 10:18:27
Done.
| |
| 2803 int ret = | |
| 2804 SetSendRtpHeaderExtension(true, kRtpExtensionTransportSequenceNumber, id); | |
| 2805 RTC_DCHECK_EQ(0, ret); | |
|
mflodman
2015/12/03 09:24:21
Do we expect errors for other extensions?
If not,
stefan-webrtc
2015/12/03 10:18:27
I'd prefer to not touch too much of the existing V
mflodman
2015/12/03 10:38:33
Acknowledged.
the sun
2015/12/03 11:10:28
+1
| |
| 2806 } | |
| 2807 | |
| 2787 void Channel::SetRTCPStatus(bool enable) { | 2808 void Channel::SetRTCPStatus(bool enable) { |
| 2788 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2809 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2789 "Channel::SetRTCPStatus()"); | 2810 "Channel::SetRTCPStatus()"); |
| 2790 _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff); | 2811 _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff); |
| 2791 } | 2812 } |
| 2792 | 2813 |
| 2814 void Channel::SetCongestionControlObjects( | |
| 2815 RtpPacketSender* rtp_packet_sender, | |
| 2816 TransportFeedbackObserver* transport_feedback_observer, | |
| 2817 PacketRouter* packet_router) { | |
| 2818 RTC_DCHECK(!channel_state_.Get().sending); | |
| 2819 RTC_DCHECK(packet_router != nullptr || packet_router_ != nullptr); | |
| 2820 _moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get()); | |
| 2821 _rtpRtcpModule.reset(CreateRtpRtcp(rtp_packet_sender, packet_router, | |
|
mflodman
2015/12/03 09:24:21
Can we check we haven't sent anything before this
stefan-webrtc
2015/12/03 10:18:27
We check that the channel_state_ is not sending on
mflodman
2015/12/03 10:38:33
I was thinking of checking number of sent frames,
the sun
2015/12/03 11:10:28
We should be fine; the ambiguity here is transient
| |
| 2822 transport_feedback_observer)); | |
| 2823 _moduleProcessThreadPtr->RegisterModule(_rtpRtcpModule.get()); | |
| 2824 _rtpRtcpModule->SetStorePacketsStatus(rtp_packet_sender != nullptr, 600); | |
| 2825 if (packet_router != nullptr) { | |
| 2826 packet_router->AddRtpModule(_rtpRtcpModule.get()); | |
| 2827 } else { | |
| 2828 packet_router_->RemoveRtpModule(_rtpRtcpModule.get()); | |
| 2829 } | |
| 2830 packet_router_ = packet_router; | |
| 2831 } | |
| 2832 | |
| 2793 int | 2833 int |
| 2794 Channel::GetRTCPStatus(bool& enabled) | 2834 Channel::GetRTCPStatus(bool& enabled) |
| 2795 { | 2835 { |
| 2796 RtcpMode method = _rtpRtcpModule->RTCP(); | 2836 RtcpMode method = _rtpRtcpModule->RTCP(); |
| 2797 enabled = (method != RtcpMode::kOff); | 2837 enabled = (method != RtcpMode::kOff); |
| 2798 return 0; | 2838 return 0; |
| 2799 } | 2839 } |
| 2800 | 2840 |
| 2801 int | 2841 int |
| 2802 Channel::SetRTCP_CNAME(const char cName[256]) | 2842 Channel::SetRTCP_CNAME(const char cName[256]) |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3942 int64_t min_rtt = 0; | 3982 int64_t min_rtt = 0; |
| 3943 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) | 3983 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) |
| 3944 != 0) { | 3984 != 0) { |
| 3945 return 0; | 3985 return 0; |
| 3946 } | 3986 } |
| 3947 return rtt; | 3987 return rtt; |
| 3948 } | 3988 } |
| 3949 | 3989 |
| 3950 } // namespace voe | 3990 } // namespace voe |
| 3951 } // namespace webrtc | 3991 } // namespace webrtc |
| OLD | NEW |