| 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/thread_checker.h" |
| 18 #include "webrtc/base/timeutils.h" | 19 #include "webrtc/base/timeutils.h" |
| 19 #include "webrtc/common.h" | 20 #include "webrtc/common.h" |
| 20 #include "webrtc/config.h" | 21 #include "webrtc/config.h" |
| 21 #include "webrtc/modules/audio_device/include/audio_device.h" | 22 #include "webrtc/modules/audio_device/include/audio_device.h" |
| 22 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 23 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 23 #include "webrtc/modules/include/module_common_types.h" | 24 #include "webrtc/modules/include/module_common_types.h" |
| 25 #include "webrtc/modules/pacing/packet_router.h" |
| 24 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 26 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
| 26 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" |
| 28 #include "webrtc/modules/utility/include/audio_frame_operations.h" | 30 #include "webrtc/modules/utility/include/audio_frame_operations.h" |
| 29 #include "webrtc/modules/utility/include/process_thread.h" | 31 #include "webrtc/modules/utility/include/process_thread.h" |
| 30 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 32 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 31 #include "webrtc/system_wrappers/include/trace.h" | 33 #include "webrtc/system_wrappers/include/trace.h" |
| 32 #include "webrtc/voice_engine/include/voe_base.h" | 34 #include "webrtc/voice_engine/include/voe_base.h" |
| 33 #include "webrtc/voice_engine/include/voe_external_media.h" | 35 #include "webrtc/voice_engine/include/voe_external_media.h" |
| 34 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 36 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
| 35 #include "webrtc/voice_engine/output_mixer.h" | 37 #include "webrtc/voice_engine/output_mixer.h" |
| 36 #include "webrtc/voice_engine/statistics.h" | 38 #include "webrtc/voice_engine/statistics.h" |
| 37 #include "webrtc/voice_engine/transmit_mixer.h" | 39 #include "webrtc/voice_engine/transmit_mixer.h" |
| 38 #include "webrtc/voice_engine/utility.h" | 40 #include "webrtc/voice_engine/utility.h" |
| 39 | 41 |
| 40 #if defined(_WIN32) | 42 #if defined(_WIN32) |
| 41 #include <Qos.h> | 43 #include <Qos.h> |
| 42 #endif | 44 #endif |
| 43 | 45 |
| 44 namespace webrtc { | 46 namespace webrtc { |
| 45 namespace voe { | 47 namespace voe { |
| 46 | 48 |
| 49 class TransportFeedbackProxy : public TransportFeedbackObserver { |
| 50 public: |
| 51 TransportFeedbackProxy() : feedback_observer_(nullptr) { |
| 52 pacer_thread_.DetachFromThread(); |
| 53 network_thread_.DetachFromThread(); |
| 54 } |
| 55 |
| 56 void SetTransportFeedbackObserver( |
| 57 TransportFeedbackObserver* feedback_observer) { |
| 58 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 59 rtc::CritScope lock(&crit_); |
| 60 feedback_observer_ = feedback_observer; |
| 61 } |
| 62 |
| 63 // Implements TransportFeedbackObserver. |
| 64 void AddPacket(uint16_t sequence_number, |
| 65 size_t length, |
| 66 bool was_paced) override { |
| 67 RTC_DCHECK(pacer_thread_.CalledOnValidThread()); |
| 68 rtc::CritScope lock(&crit_); |
| 69 if (feedback_observer_) |
| 70 feedback_observer_->AddPacket(sequence_number, length, was_paced); |
| 71 } |
| 72 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override { |
| 73 RTC_DCHECK(network_thread_.CalledOnValidThread()); |
| 74 rtc::CritScope lock(&crit_); |
| 75 if (feedback_observer_) |
| 76 feedback_observer_->OnTransportFeedback(feedback); |
| 77 } |
| 78 |
| 79 private: |
| 80 rtc::CriticalSection crit_; |
| 81 rtc::ThreadChecker thread_checker_; |
| 82 rtc::ThreadChecker pacer_thread_; |
| 83 rtc::ThreadChecker network_thread_; |
| 84 TransportFeedbackObserver* feedback_observer_ GUARDED_BY(&crit_); |
| 85 }; |
| 86 |
| 87 class TransportSequenceNumberProxy : public TransportSequenceNumberAllocator { |
| 88 public: |
| 89 TransportSequenceNumberProxy() : seq_num_allocator_(nullptr) { |
| 90 pacer_thread_.DetachFromThread(); |
| 91 } |
| 92 |
| 93 void SetSequenceNumberAllocator( |
| 94 TransportSequenceNumberAllocator* seq_num_allocator) { |
| 95 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 96 rtc::CritScope lock(&crit_); |
| 97 seq_num_allocator_ = seq_num_allocator; |
| 98 } |
| 99 |
| 100 // Implements TransportSequenceNumberAllocator. |
| 101 uint16_t AllocateSequenceNumber() override { |
| 102 RTC_DCHECK(pacer_thread_.CalledOnValidThread()); |
| 103 rtc::CritScope lock(&crit_); |
| 104 if (!seq_num_allocator_) |
| 105 return 0; |
| 106 return seq_num_allocator_->AllocateSequenceNumber(); |
| 107 } |
| 108 |
| 109 private: |
| 110 rtc::CriticalSection crit_; |
| 111 rtc::ThreadChecker thread_checker_; |
| 112 rtc::ThreadChecker pacer_thread_; |
| 113 TransportSequenceNumberAllocator* seq_num_allocator_ GUARDED_BY(&crit_); |
| 114 }; |
| 115 |
| 116 class RtpPacketSenderProxy : public RtpPacketSender { |
| 117 public: |
| 118 RtpPacketSenderProxy() : rtp_packet_sender_(nullptr) { |
| 119 } |
| 120 |
| 121 void SetPacketSender(RtpPacketSender* rtp_packet_sender) { |
| 122 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 123 rtc::CritScope lock(&crit_); |
| 124 rtp_packet_sender_ = rtp_packet_sender; |
| 125 } |
| 126 |
| 127 // Implements RtpPacketSender. |
| 128 void InsertPacket(Priority priority, |
| 129 uint32_t ssrc, |
| 130 uint16_t sequence_number, |
| 131 int64_t capture_time_ms, |
| 132 size_t bytes, |
| 133 bool retransmission) override { |
| 134 rtc::CritScope lock(&crit_); |
| 135 if (rtp_packet_sender_) { |
| 136 rtp_packet_sender_->InsertPacket(priority, ssrc, sequence_number, |
| 137 capture_time_ms, bytes, retransmission); |
| 138 } |
| 139 } |
| 140 |
| 141 private: |
| 142 rtc::ThreadChecker thread_checker_; |
| 143 rtc::CriticalSection crit_; |
| 144 RtpPacketSender* rtp_packet_sender_ GUARDED_BY(&crit_); |
| 145 }; |
| 146 |
| 47 // Extend the default RTCP statistics struct with max_jitter, defined as the | 147 // Extend the default RTCP statistics struct with max_jitter, defined as the |
| 48 // maximum jitter value seen in an RTCP report block. | 148 // maximum jitter value seen in an RTCP report block. |
| 49 struct ChannelStatistics : public RtcpStatistics { | 149 struct ChannelStatistics : public RtcpStatistics { |
| 50 ChannelStatistics() : rtcp(), max_jitter(0) {} | 150 ChannelStatistics() : rtcp(), max_jitter(0) {} |
| 51 | 151 |
| 52 RtcpStatistics rtcp; | 152 RtcpStatistics rtcp; |
| 53 uint32_t max_jitter; | 153 uint32_t max_jitter; |
| 54 }; | 154 }; |
| 55 | 155 |
| 56 // Statistics callback, called at each generation of a new RTCP report block. | 156 // Statistics callback, called at each generation of a new RTCP report block. |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, | 783 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, |
| 684 VoEId(_instanceId,_channelId), | 784 VoEId(_instanceId,_channelId), |
| 685 "Channel::RecordFileEnded() => output file recorder module is" | 785 "Channel::RecordFileEnded() => output file recorder module is" |
| 686 " shutdown"); | 786 " shutdown"); |
| 687 } | 787 } |
| 688 | 788 |
| 689 Channel::Channel(int32_t channelId, | 789 Channel::Channel(int32_t channelId, |
| 690 uint32_t instanceId, | 790 uint32_t instanceId, |
| 691 RtcEventLog* const event_log, | 791 RtcEventLog* const event_log, |
| 692 const Config& config) | 792 const Config& config) |
| 693 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 793 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |
| 694 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 794 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |
| 695 volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()), | 795 volume_settings_critsect_( |
| 696 _instanceId(instanceId), | 796 *CriticalSectionWrapper::CreateCriticalSection()), |
| 697 _channelId(channelId), | 797 _instanceId(instanceId), |
| 698 event_log_(event_log), | 798 _channelId(channelId), |
| 699 rtp_header_parser_(RtpHeaderParser::Create()), | 799 event_log_(event_log), |
| 700 rtp_payload_registry_( | 800 rtp_header_parser_(RtpHeaderParser::Create()), |
| 701 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), | 801 rtp_payload_registry_( |
| 702 rtp_receive_statistics_( | 802 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), |
| 703 ReceiveStatistics::Create(Clock::GetRealTimeClock())), | 803 rtp_receive_statistics_( |
| 704 rtp_receiver_( | 804 ReceiveStatistics::Create(Clock::GetRealTimeClock())), |
| 705 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), | 805 rtp_receiver_( |
| 706 this, | 806 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), |
| 707 this, | 807 this, |
| 708 this, | 808 this, |
| 709 rtp_payload_registry_.get())), | 809 this, |
| 710 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), | 810 rtp_payload_registry_.get())), |
| 711 _outputAudioLevel(), | 811 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), |
| 712 _externalTransport(false), | 812 _outputAudioLevel(), |
| 713 _inputFilePlayerPtr(NULL), | 813 _externalTransport(false), |
| 714 _outputFilePlayerPtr(NULL), | 814 _inputFilePlayerPtr(NULL), |
| 715 _outputFileRecorderPtr(NULL), | 815 _outputFilePlayerPtr(NULL), |
| 716 // Avoid conflict with other channels by adding 1024 - 1026, | 816 _outputFileRecorderPtr(NULL), |
| 717 // won't use as much as 1024 channels. | 817 // Avoid conflict with other channels by adding 1024 - 1026, |
| 718 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), | 818 // won't use as much as 1024 channels. |
| 719 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), | 819 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), |
| 720 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), | 820 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), |
| 721 _outputFileRecording(false), | 821 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), |
| 722 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), | 822 _outputFileRecording(false), |
| 723 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), | 823 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), |
| 724 _outputExternalMedia(false), | 824 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), |
| 725 _inputExternalMediaCallbackPtr(NULL), | 825 _outputExternalMedia(false), |
| 726 _outputExternalMediaCallbackPtr(NULL), | 826 _inputExternalMediaCallbackPtr(NULL), |
| 727 _timeStamp(0), // This is just an offset, RTP module will add it's own | 827 _outputExternalMediaCallbackPtr(NULL), |
| 728 // random offset | 828 _timeStamp(0), // This is just an offset, RTP module will add it's own |
| 729 _sendTelephoneEventPayloadType(106), | 829 // random offset |
| 730 ntp_estimator_(Clock::GetRealTimeClock()), | 830 _sendTelephoneEventPayloadType(106), |
| 731 jitter_buffer_playout_timestamp_(0), | 831 ntp_estimator_(Clock::GetRealTimeClock()), |
| 732 playout_timestamp_rtp_(0), | 832 jitter_buffer_playout_timestamp_(0), |
| 733 playout_timestamp_rtcp_(0), | 833 playout_timestamp_rtp_(0), |
| 734 playout_delay_ms_(0), | 834 playout_timestamp_rtcp_(0), |
| 735 _numberOfDiscardedPackets(0), | 835 playout_delay_ms_(0), |
| 736 send_sequence_number_(0), | 836 _numberOfDiscardedPackets(0), |
| 737 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 837 send_sequence_number_(0), |
| 738 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), | 838 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 739 capture_start_rtp_time_stamp_(-1), | 839 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), |
| 740 capture_start_ntp_time_ms_(-1), | 840 capture_start_rtp_time_stamp_(-1), |
| 741 _engineStatisticsPtr(NULL), | 841 capture_start_ntp_time_ms_(-1), |
| 742 _outputMixerPtr(NULL), | 842 _engineStatisticsPtr(NULL), |
| 743 _transmitMixerPtr(NULL), | 843 _outputMixerPtr(NULL), |
| 744 _moduleProcessThreadPtr(NULL), | 844 _transmitMixerPtr(NULL), |
| 745 _audioDeviceModulePtr(NULL), | 845 _moduleProcessThreadPtr(NULL), |
| 746 _voiceEngineObserverPtr(NULL), | 846 _audioDeviceModulePtr(NULL), |
| 747 _callbackCritSectPtr(NULL), | 847 _voiceEngineObserverPtr(NULL), |
| 748 _transportPtr(NULL), | 848 _callbackCritSectPtr(NULL), |
| 749 _rxVadObserverPtr(NULL), | 849 _transportPtr(NULL), |
| 750 _oldVadDecision(-1), | 850 _rxVadObserverPtr(NULL), |
| 751 _sendFrameType(0), | 851 _oldVadDecision(-1), |
| 752 _externalMixing(false), | 852 _sendFrameType(0), |
| 753 _mixFileWithMicrophone(false), | 853 _externalMixing(false), |
| 754 _mute(false), | 854 _mixFileWithMicrophone(false), |
| 755 _panLeft(1.0f), | 855 _mute(false), |
| 756 _panRight(1.0f), | 856 _panLeft(1.0f), |
| 757 _outputGain(1.0f), | 857 _panRight(1.0f), |
| 758 _playOutbandDtmfEvent(false), | 858 _outputGain(1.0f), |
| 759 _playInbandDtmfEvent(false), | 859 _playOutbandDtmfEvent(false), |
| 760 _lastLocalTimeStamp(0), | 860 _playInbandDtmfEvent(false), |
| 761 _lastPayloadType(0), | 861 _lastLocalTimeStamp(0), |
| 762 _includeAudioLevelIndication(false), | 862 _lastPayloadType(0), |
| 763 _outputSpeechType(AudioFrame::kNormalSpeech), | 863 _includeAudioLevelIndication(false), |
| 764 video_sync_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 864 _outputSpeechType(AudioFrame::kNormalSpeech), |
| 765 _average_jitter_buffer_delay_us(0), | 865 video_sync_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 766 _previousTimestamp(0), | 866 _average_jitter_buffer_delay_us(0), |
| 767 _recPacketDelayMs(20), | 867 _previousTimestamp(0), |
| 768 _RxVadDetection(false), | 868 _recPacketDelayMs(20), |
| 769 _rxAgcIsEnabled(false), | 869 _RxVadDetection(false), |
| 770 _rxNsIsEnabled(false), | 870 _rxAgcIsEnabled(false), |
| 771 restored_packet_in_use_(false), | 871 _rxNsIsEnabled(false), |
| 772 rtcp_observer_(new VoERtcpObserver(this)), | 872 restored_packet_in_use_(false), |
| 773 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), | 873 rtcp_observer_(new VoERtcpObserver(this)), |
| 774 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 874 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), |
| 775 associate_send_channel_(ChannelOwner(nullptr)) { | 875 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 876 associate_send_channel_(ChannelOwner(nullptr)), |
| 877 pacing_enabled_(config.Get<VoicePacing>().enabled), |
| 878 feedback_observer_proxy_(pacing_enabled_ ? new TransportFeedbackProxy() |
| 879 : nullptr), |
| 880 seq_num_allocator_proxy_( |
| 881 pacing_enabled_ ? new TransportSequenceNumberProxy() : nullptr), |
| 882 rtp_packet_sender_proxy_(pacing_enabled_ ? new RtpPacketSenderProxy() |
| 883 : nullptr) { |
| 776 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), | 884 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), |
| 777 "Channel::Channel() - ctor"); | 885 "Channel::Channel() - ctor"); |
| 778 AudioCodingModule::Config acm_config; | 886 AudioCodingModule::Config acm_config; |
| 779 acm_config.id = VoEModuleId(instanceId, channelId); | 887 acm_config.id = VoEModuleId(instanceId, channelId); |
| 780 if (config.Get<NetEqCapacityConfig>().enabled) { | 888 if (config.Get<NetEqCapacityConfig>().enabled) { |
| 781 // Clamping the buffer capacity at 20 packets. While going lower will | 889 // Clamping the buffer capacity at 20 packets. While going lower will |
| 782 // probably work, it makes little sense. | 890 // probably work, it makes little sense. |
| 783 acm_config.neteq_config.max_packets_in_buffer = | 891 acm_config.neteq_config.max_packets_in_buffer = |
| 784 std::max(20, config.Get<NetEqCapacityConfig>().capacity); | 892 std::max(20, config.Get<NetEqCapacityConfig>().capacity); |
| 785 } | 893 } |
| 786 acm_config.neteq_config.enable_fast_accelerate = | 894 acm_config.neteq_config.enable_fast_accelerate = |
| 787 config.Get<NetEqFastAccelerate>().enabled; | 895 config.Get<NetEqFastAccelerate>().enabled; |
| 788 audio_coding_.reset(AudioCodingModule::Create(acm_config)); | 896 audio_coding_.reset(AudioCodingModule::Create(acm_config)); |
| 789 | 897 |
| 790 _inbandDtmfQueue.ResetDtmf(); | 898 _inbandDtmfQueue.ResetDtmf(); |
| 791 _inbandDtmfGenerator.Init(); | 899 _inbandDtmfGenerator.Init(); |
| 792 _outputAudioLevel.Clear(); | 900 _outputAudioLevel.Clear(); |
| 793 | 901 |
| 794 RtpRtcp::Configuration configuration; | 902 RtpRtcp::Configuration configuration; |
| 795 configuration.audio = true; | 903 configuration.audio = true; |
| 796 configuration.outgoing_transport = this; | 904 configuration.outgoing_transport = this; |
| 797 configuration.audio_messages = this; | 905 configuration.audio_messages = this; |
| 798 configuration.receive_statistics = rtp_receive_statistics_.get(); | 906 configuration.receive_statistics = rtp_receive_statistics_.get(); |
| 799 configuration.bandwidth_callback = rtcp_observer_.get(); | 907 configuration.bandwidth_callback = rtcp_observer_.get(); |
| 908 configuration.paced_sender = rtp_packet_sender_proxy_.get(); |
| 909 configuration.transport_sequence_number_allocator = |
| 910 seq_num_allocator_proxy_.get(); |
| 911 configuration.transport_feedback_callback = feedback_observer_proxy_.get(); |
| 800 | 912 |
| 801 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); | 913 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); |
| 802 | 914 |
| 803 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); | 915 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); |
| 804 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( | 916 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( |
| 805 statistics_proxy_.get()); | 917 statistics_proxy_.get()); |
| 806 | 918 |
| 807 Config audioproc_config; | 919 Config audioproc_config; |
| 808 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); | 920 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
| 809 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config)); | 921 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config)); |
| (...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) { | 2892 int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) { |
| 2781 rtp_header_parser_->DeregisterRtpHeaderExtension( | 2893 rtp_header_parser_->DeregisterRtpHeaderExtension( |
| 2782 kRtpExtensionAbsoluteSendTime); | 2894 kRtpExtensionAbsoluteSendTime); |
| 2783 if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension( | 2895 if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension( |
| 2784 kRtpExtensionAbsoluteSendTime, id)) { | 2896 kRtpExtensionAbsoluteSendTime, id)) { |
| 2785 return -1; | 2897 return -1; |
| 2786 } | 2898 } |
| 2787 return 0; | 2899 return 0; |
| 2788 } | 2900 } |
| 2789 | 2901 |
| 2902 void Channel::EnableSendTransportSequenceNumber(int id) { |
| 2903 int ret = |
| 2904 SetSendRtpHeaderExtension(true, kRtpExtensionTransportSequenceNumber, id); |
| 2905 RTC_DCHECK_EQ(0, ret); |
| 2906 } |
| 2907 |
| 2908 void Channel::SetCongestionControlObjects( |
| 2909 RtpPacketSender* rtp_packet_sender, |
| 2910 TransportFeedbackObserver* transport_feedback_observer, |
| 2911 PacketRouter* packet_router) { |
| 2912 RTC_DCHECK(feedback_observer_proxy_.get()); |
| 2913 RTC_DCHECK(seq_num_allocator_proxy_.get()); |
| 2914 RTC_DCHECK(rtp_packet_sender_proxy_.get()); |
| 2915 RTC_DCHECK(packet_router != nullptr || packet_router_ != nullptr); |
| 2916 feedback_observer_proxy_->SetTransportFeedbackObserver( |
| 2917 transport_feedback_observer); |
| 2918 seq_num_allocator_proxy_->SetSequenceNumberAllocator(packet_router); |
| 2919 rtp_packet_sender_proxy_->SetPacketSender(rtp_packet_sender); |
| 2920 _rtpRtcpModule->SetStorePacketsStatus(rtp_packet_sender != nullptr, 600); |
| 2921 if (packet_router != nullptr) { |
| 2922 packet_router->AddRtpModule(_rtpRtcpModule.get()); |
| 2923 } else { |
| 2924 packet_router_->RemoveRtpModule(_rtpRtcpModule.get()); |
| 2925 } |
| 2926 packet_router_ = packet_router; |
| 2927 } |
| 2928 |
| 2790 void Channel::SetRTCPStatus(bool enable) { | 2929 void Channel::SetRTCPStatus(bool enable) { |
| 2791 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2930 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2792 "Channel::SetRTCPStatus()"); | 2931 "Channel::SetRTCPStatus()"); |
| 2793 _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff); | 2932 _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff); |
| 2794 } | 2933 } |
| 2795 | 2934 |
| 2796 int | 2935 int |
| 2797 Channel::GetRTCPStatus(bool& enabled) | 2936 Channel::GetRTCPStatus(bool& enabled) |
| 2798 { | 2937 { |
| 2799 RtcpMode method = _rtpRtcpModule->RTCP(); | 2938 RtcpMode method = _rtpRtcpModule->RTCP(); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3158 return 0; | 3297 return 0; |
| 3159 } | 3298 } |
| 3160 | 3299 |
| 3161 bool Channel::GetCodecFECStatus() { | 3300 bool Channel::GetCodecFECStatus() { |
| 3162 bool enabled = audio_coding_->CodecFEC(); | 3301 bool enabled = audio_coding_->CodecFEC(); |
| 3163 return enabled; | 3302 return enabled; |
| 3164 } | 3303 } |
| 3165 | 3304 |
| 3166 void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { | 3305 void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { |
| 3167 // None of these functions can fail. | 3306 // None of these functions can fail. |
| 3168 _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); | 3307 // If pacing is enabled we always store packets. |
| 3308 if (!pacing_enabled_) |
| 3309 _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); |
| 3169 rtp_receive_statistics_->SetMaxReorderingThreshold(maxNumberOfPackets); | 3310 rtp_receive_statistics_->SetMaxReorderingThreshold(maxNumberOfPackets); |
| 3170 rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff); | 3311 rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff); |
| 3171 if (enable) | 3312 if (enable) |
| 3172 audio_coding_->EnableNack(maxNumberOfPackets); | 3313 audio_coding_->EnableNack(maxNumberOfPackets); |
| 3173 else | 3314 else |
| 3174 audio_coding_->DisableNack(); | 3315 audio_coding_->DisableNack(); |
| 3175 } | 3316 } |
| 3176 | 3317 |
| 3177 // Called when we are missing one or more packets. | 3318 // Called when we are missing one or more packets. |
| 3178 int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) { | 3319 int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) { |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3945 int64_t min_rtt = 0; | 4086 int64_t min_rtt = 0; |
| 3946 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) | 4087 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) |
| 3947 != 0) { | 4088 != 0) { |
| 3948 return 0; | 4089 return 0; |
| 3949 } | 4090 } |
| 3950 return rtt; | 4091 return rtt; |
| 3951 } | 4092 } |
| 3952 | 4093 |
| 3953 } // namespace voe | 4094 } // namespace voe |
| 3954 } // namespace webrtc | 4095 } // namespace webrtc |
| OLD | NEW |