Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 1479023002: Prepare the AudioSendStream to be hooked up to send-side BWE. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
34 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 35 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
35 #include "webrtc/voice_engine/output_mixer.h" 36 #include "webrtc/voice_engine/output_mixer.h"
36 #include "webrtc/voice_engine/statistics.h" 37 #include "webrtc/voice_engine/statistics.h"
37 #include "webrtc/voice_engine/transmit_mixer.h" 38 #include "webrtc/voice_engine/transmit_mixer.h"
38 #include "webrtc/voice_engine/utility.h" 39 #include "webrtc/voice_engine/utility.h"
39 40
40 #if defined(_WIN32) 41 #if defined(_WIN32)
41 #include <Qos.h> 42 #include <Qos.h>
42 #endif 43 #endif
43 44
44 namespace webrtc { 45 namespace webrtc {
45 namespace voe { 46 namespace voe {
47 namespace {
48
49 class PacketSenderProxy : public RtpPacketSender,
50 public TransportFeedbackObserver,
51 public TransportSequenceNumberAllocator {
52 public:
53 PacketSenderProxy()
54 : packet_sender_(nullptr),
55 feedback_observer_(nullptr),
56 seq_num_allocator_(nullptr) {
57 encoder_thread_.DetachFromThread();
58 pacer_thread_.DetachFromThread();
59 network_thread_.DetachFromThread();
60 }
61
62 void SetCongestionControlObjects(
63 RtpPacketSender* rtp_packet_sender,
64 TransportFeedbackObserver* transport_feedback_observer,
65 TransportSequenceNumberAllocator* seq_num_allocator) {
66 RTC_DCHECK(thread_checker_.CalledOnValidThread());
67 rtc::CritScope lock(&crit_);
68 packet_sender_ = rtp_packet_sender;
69 feedback_observer_ = transport_feedback_observer;
70 seq_num_allocator_ = seq_num_allocator;
71 }
72
73 // Implements RtpPacketSender.
74 void InsertPacket(Priority priority,
75 uint32_t ssrc,
76 uint16_t sequence_number,
77 int64_t capture_time_ms,
78 size_t bytes,
79 bool retransmission) override {
80 RTC_DCHECK(encoder_thread_.CalledOnValidThread());
81 RtpPacketSender* packet_sender;
82 {
83 rtc::CritScope lock(&crit_);
84 if (packet_sender_ == nullptr)
85 return;
86 packet_sender = packet_sender_;
87 }
88 packet_sender->InsertPacket(priority, ssrc, sequence_number,
89 capture_time_ms, bytes, retransmission);
90 }
91
92 // Implements TransportFeedbackObserver.
93 void AddPacket(uint16_t sequence_number,
94 size_t length,
95 bool was_paced) override {
96 RTC_DCHECK(pacer_thread_.CalledOnValidThread());
97 TransportFeedbackObserver* feedback_observer;
98 {
99 rtc::CritScope lock(&crit_);
100 if (feedback_observer_ == nullptr)
101 return;
102 feedback_observer = feedback_observer_;
103 }
104 feedback_observer->AddPacket(sequence_number, length, was_paced);
105 }
106 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override {
107 RTC_DCHECK(network_thread_.CalledOnValidThread());
108 TransportFeedbackObserver* feedback_observer;
109 {
110 rtc::CritScope lock(&crit_);
111 if (feedback_observer_ == nullptr)
112 return;
113 feedback_observer = feedback_observer_;
114 }
115 feedback_observer->OnTransportFeedback(feedback);
116 }
117
118 // Implements TransportSequenceNumberAllocator.
119 uint16_t AllocateSequenceNumber() override {
120 RTC_DCHECK(pacer_thread_.CalledOnValidThread());
121 TransportSequenceNumberAllocator* seq_num_allocator;
122 {
123 rtc::CritScope lock(&crit_);
124 RTC_DCHECK(seq_num_allocator_ != nullptr);
125 seq_num_allocator = seq_num_allocator_;
126 }
127 return seq_num_allocator->AllocateSequenceNumber();
128 }
129
130 private:
the sun 2015/12/01 10:25:36 Wow! So with this critsect, this class becomes a c
stefan-webrtc 2015/12/01 16:19:33 Right, not very nice. I redid it to only copy the
the sun 2015/12/01 16:48:23 I think we might be able to get away with it in th
stefan-webrtc 2015/12/02 16:14:17 Done.
131 rtc::ThreadChecker thread_checker_;
132 rtc::ThreadChecker encoder_thread_;
133 rtc::ThreadChecker pacer_thread_;
134 rtc::ThreadChecker network_thread_;
135 rtc::CriticalSection crit_;
136 RtpPacketSender* packet_sender_ GUARDED_BY(&crit_);
137 TransportFeedbackObserver* feedback_observer_ GUARDED_BY(&crit_);
138 TransportSequenceNumberAllocator* seq_num_allocator_ GUARDED_BY(&crit_);
139 };
140 } // namespace
46 141
47 // Extend the default RTCP statistics struct with max_jitter, defined as the 142 // Extend the default RTCP statistics struct with max_jitter, defined as the
48 // maximum jitter value seen in an RTCP report block. 143 // maximum jitter value seen in an RTCP report block.
49 struct ChannelStatistics : public RtcpStatistics { 144 struct ChannelStatistics : public RtcpStatistics {
50 ChannelStatistics() : rtcp(), max_jitter(0) {} 145 ChannelStatistics() : rtcp(), max_jitter(0) {}
51 146
52 RtcpStatistics rtcp; 147 RtcpStatistics rtcp;
53 uint32_t max_jitter; 148 uint32_t max_jitter;
54 }; 149 };
55 150
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, 778 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
684 VoEId(_instanceId,_channelId), 779 VoEId(_instanceId,_channelId),
685 "Channel::RecordFileEnded() => output file recorder module is" 780 "Channel::RecordFileEnded() => output file recorder module is"
686 " shutdown"); 781 " shutdown");
687 } 782 }
688 783
689 Channel::Channel(int32_t channelId, 784 Channel::Channel(int32_t channelId,
690 uint32_t instanceId, 785 uint32_t instanceId,
691 RtcEventLog* const event_log, 786 RtcEventLog* const event_log,
692 const Config& config) 787 const Config& config)
693 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), 788 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
694 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), 789 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
695 volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()), 790 volume_settings_critsect_(
696 _instanceId(instanceId), 791 *CriticalSectionWrapper::CreateCriticalSection()),
697 _channelId(channelId), 792 _instanceId(instanceId),
698 event_log_(event_log), 793 _channelId(channelId),
699 rtp_header_parser_(RtpHeaderParser::Create()), 794 event_log_(event_log),
700 rtp_payload_registry_( 795 rtp_header_parser_(RtpHeaderParser::Create()),
701 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), 796 rtp_payload_registry_(
702 rtp_receive_statistics_( 797 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
703 ReceiveStatistics::Create(Clock::GetRealTimeClock())), 798 rtp_receive_statistics_(
704 rtp_receiver_( 799 ReceiveStatistics::Create(Clock::GetRealTimeClock())),
705 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), 800 rtp_receiver_(
706 this, 801 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(),
707 this, 802 this,
708 this, 803 this,
709 rtp_payload_registry_.get())), 804 this,
710 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), 805 rtp_payload_registry_.get())),
711 _outputAudioLevel(), 806 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()),
712 _externalTransport(false), 807 _outputAudioLevel(),
713 _inputFilePlayerPtr(NULL), 808 _externalTransport(false),
714 _outputFilePlayerPtr(NULL), 809 _inputFilePlayerPtr(NULL),
715 _outputFileRecorderPtr(NULL), 810 _outputFilePlayerPtr(NULL),
716 // Avoid conflict with other channels by adding 1024 - 1026, 811 _outputFileRecorderPtr(NULL),
717 // won't use as much as 1024 channels. 812 // Avoid conflict with other channels by adding 1024 - 1026,
718 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), 813 // won't use as much as 1024 channels.
719 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), 814 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024),
720 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), 815 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025),
721 _outputFileRecording(false), 816 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026),
722 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), 817 _outputFileRecording(false),
723 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), 818 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)),
724 _outputExternalMedia(false), 819 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)),
725 _inputExternalMediaCallbackPtr(NULL), 820 _outputExternalMedia(false),
726 _outputExternalMediaCallbackPtr(NULL), 821 _inputExternalMediaCallbackPtr(NULL),
727 _timeStamp(0), // This is just an offset, RTP module will add it's own 822 _outputExternalMediaCallbackPtr(NULL),
728 // random offset 823 _timeStamp(0), // This is just an offset, RTP module will add it's own
729 _sendTelephoneEventPayloadType(106), 824 // random offset
730 ntp_estimator_(Clock::GetRealTimeClock()), 825 _sendTelephoneEventPayloadType(106),
731 jitter_buffer_playout_timestamp_(0), 826 ntp_estimator_(Clock::GetRealTimeClock()),
732 playout_timestamp_rtp_(0), 827 jitter_buffer_playout_timestamp_(0),
733 playout_timestamp_rtcp_(0), 828 playout_timestamp_rtp_(0),
734 playout_delay_ms_(0), 829 playout_timestamp_rtcp_(0),
735 _numberOfDiscardedPackets(0), 830 playout_delay_ms_(0),
736 send_sequence_number_(0), 831 _numberOfDiscardedPackets(0),
737 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), 832 send_sequence_number_(0),
738 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), 833 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()),
739 capture_start_rtp_time_stamp_(-1), 834 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()),
740 capture_start_ntp_time_ms_(-1), 835 capture_start_rtp_time_stamp_(-1),
741 _engineStatisticsPtr(NULL), 836 capture_start_ntp_time_ms_(-1),
742 _outputMixerPtr(NULL), 837 _engineStatisticsPtr(NULL),
743 _transmitMixerPtr(NULL), 838 _outputMixerPtr(NULL),
744 _moduleProcessThreadPtr(NULL), 839 _transmitMixerPtr(NULL),
745 _audioDeviceModulePtr(NULL), 840 _moduleProcessThreadPtr(NULL),
746 _voiceEngineObserverPtr(NULL), 841 _audioDeviceModulePtr(NULL),
747 _callbackCritSectPtr(NULL), 842 _voiceEngineObserverPtr(NULL),
748 _transportPtr(NULL), 843 _callbackCritSectPtr(NULL),
749 _rxVadObserverPtr(NULL), 844 _transportPtr(NULL),
750 _oldVadDecision(-1), 845 _rxVadObserverPtr(NULL),
751 _sendFrameType(0), 846 _oldVadDecision(-1),
752 _externalMixing(false), 847 _sendFrameType(0),
753 _mixFileWithMicrophone(false), 848 _externalMixing(false),
754 _mute(false), 849 _mixFileWithMicrophone(false),
755 _panLeft(1.0f), 850 _mute(false),
756 _panRight(1.0f), 851 _panLeft(1.0f),
757 _outputGain(1.0f), 852 _panRight(1.0f),
758 _playOutbandDtmfEvent(false), 853 _outputGain(1.0f),
759 _playInbandDtmfEvent(false), 854 _playOutbandDtmfEvent(false),
760 _lastLocalTimeStamp(0), 855 _playInbandDtmfEvent(false),
761 _lastPayloadType(0), 856 _lastLocalTimeStamp(0),
762 _includeAudioLevelIndication(false), 857 _lastPayloadType(0),
763 _outputSpeechType(AudioFrame::kNormalSpeech), 858 _includeAudioLevelIndication(false),
764 video_sync_lock_(CriticalSectionWrapper::CreateCriticalSection()), 859 _outputSpeechType(AudioFrame::kNormalSpeech),
765 _average_jitter_buffer_delay_us(0), 860 video_sync_lock_(CriticalSectionWrapper::CreateCriticalSection()),
766 _previousTimestamp(0), 861 _average_jitter_buffer_delay_us(0),
767 _recPacketDelayMs(20), 862 _previousTimestamp(0),
768 _RxVadDetection(false), 863 _recPacketDelayMs(20),
769 _rxAgcIsEnabled(false), 864 _RxVadDetection(false),
770 _rxNsIsEnabled(false), 865 _rxAgcIsEnabled(false),
771 restored_packet_in_use_(false), 866 _rxNsIsEnabled(false),
772 rtcp_observer_(new VoERtcpObserver(this)), 867 restored_packet_in_use_(false),
773 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), 868 rtcp_observer_(new VoERtcpObserver(this)),
774 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), 869 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())),
775 associate_send_channel_(ChannelOwner(nullptr)) { 870 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()),
871 associate_send_channel_(ChannelOwner(nullptr)),
872 packet_sender_proxy_(config.Get<VoicePacing>().enabled
873 ? new PacketSenderProxy()
874 : nullptr),
875 packet_router_(nullptr) {
776 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), 876 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId),
777 "Channel::Channel() - ctor"); 877 "Channel::Channel() - ctor");
778 AudioCodingModule::Config acm_config; 878 AudioCodingModule::Config acm_config;
779 acm_config.id = VoEModuleId(instanceId, channelId); 879 acm_config.id = VoEModuleId(instanceId, channelId);
780 if (config.Get<NetEqCapacityConfig>().enabled) { 880 if (config.Get<NetEqCapacityConfig>().enabled) {
781 // Clamping the buffer capacity at 20 packets. While going lower will 881 // Clamping the buffer capacity at 20 packets. While going lower will
782 // probably work, it makes little sense. 882 // probably work, it makes little sense.
783 acm_config.neteq_config.max_packets_in_buffer = 883 acm_config.neteq_config.max_packets_in_buffer =
784 std::max(20, config.Get<NetEqCapacityConfig>().capacity); 884 std::max(20, config.Get<NetEqCapacityConfig>().capacity);
785 } 885 }
786 acm_config.neteq_config.enable_fast_accelerate = 886 acm_config.neteq_config.enable_fast_accelerate =
787 config.Get<NetEqFastAccelerate>().enabled; 887 config.Get<NetEqFastAccelerate>().enabled;
788 audio_coding_.reset(AudioCodingModule::Create(acm_config)); 888 audio_coding_.reset(AudioCodingModule::Create(acm_config));
789 889
790 _inbandDtmfQueue.ResetDtmf(); 890 _inbandDtmfQueue.ResetDtmf();
791 _inbandDtmfGenerator.Init(); 891 _inbandDtmfGenerator.Init();
792 _outputAudioLevel.Clear(); 892 _outputAudioLevel.Clear();
793 893
794 RtpRtcp::Configuration configuration; 894 RtpRtcp::Configuration configuration;
795 configuration.audio = true; 895 configuration.audio = true;
796 configuration.outgoing_transport = this; 896 configuration.outgoing_transport = this;
797 configuration.audio_messages = this; 897 configuration.audio_messages = this;
798 configuration.receive_statistics = rtp_receive_statistics_.get(); 898 configuration.receive_statistics = rtp_receive_statistics_.get();
799 configuration.bandwidth_callback = rtcp_observer_.get(); 899 configuration.bandwidth_callback = rtcp_observer_.get();
900 configuration.paced_sender = packet_sender_proxy_.get();
800 901
801 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration)); 902 _rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
802 903
803 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC())); 904 statistics_proxy_.reset(new StatisticsProxy(_rtpRtcpModule->SSRC()));
804 rtp_receive_statistics_->RegisterRtcpStatisticsCallback( 905 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(
805 statistics_proxy_.get()); 906 statistics_proxy_.get());
806 907
807 Config audioproc_config; 908 Config audioproc_config;
808 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); 909 audioproc_config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
809 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config)); 910 rx_audioproc_.reset(AudioProcessing::Create(audioproc_config));
810 } 911 }
811 912
812 Channel::~Channel() 913 Channel::~Channel()
813 { 914 {
814 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL); 915 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL);
815 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), 916 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId),
816 "Channel::~Channel() - dtor"); 917 "Channel::~Channel() - dtor");
817 918
818 if (_outputExternalMedia) 919 if (_outputExternalMedia)
819 { 920 {
820 DeRegisterExternalMediaProcessing(kPlaybackPerChannel); 921 DeRegisterExternalMediaProcessing(kPlaybackPerChannel);
821 } 922 }
822 if (channel_state_.Get().input_external_media) 923 if (channel_state_.Get().input_external_media)
823 { 924 {
824 DeRegisterExternalMediaProcessing(kRecordingPerChannel); 925 DeRegisterExternalMediaProcessing(kRecordingPerChannel);
825 } 926 }
826 StopSend(); 927 StopSend();
928 if (packet_router_ != nullptr)
929 packet_router_->RemoveRtpModule(_rtpRtcpModule.get());
827 StopPlayout(); 930 StopPlayout();
828 931
829 { 932 {
830 CriticalSectionScoped cs(&_fileCritSect); 933 CriticalSectionScoped cs(&_fileCritSect);
831 if (_inputFilePlayerPtr) 934 if (_inputFilePlayerPtr)
832 { 935 {
833 _inputFilePlayerPtr->RegisterModuleFileCallback(NULL); 936 _inputFilePlayerPtr->RegisterModuleFileCallback(NULL);
834 _inputFilePlayerPtr->StopPlayingFile(); 937 _inputFilePlayerPtr->StopPlayingFile();
835 FilePlayer::DestroyFilePlayer(_inputFilePlayerPtr); 938 FilePlayer::DestroyFilePlayer(_inputFilePlayerPtr);
836 _inputFilePlayerPtr = NULL; 939 _inputFilePlayerPtr = NULL;
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) { 2880 int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) {
2778 rtp_header_parser_->DeregisterRtpHeaderExtension( 2881 rtp_header_parser_->DeregisterRtpHeaderExtension(
2779 kRtpExtensionAbsoluteSendTime); 2882 kRtpExtensionAbsoluteSendTime);
2780 if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension( 2883 if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension(
2781 kRtpExtensionAbsoluteSendTime, id)) { 2884 kRtpExtensionAbsoluteSendTime, id)) {
2782 return -1; 2885 return -1;
2783 } 2886 }
2784 return 0; 2887 return 0;
2785 } 2888 }
2786 2889
2890 void Channel::SetSendTransportSequenceNumber(int id) {
2891 int ret =
2892 SetSendRtpHeaderExtension(true, kRtpExtensionTransportSequenceNumber, id);
2893 RTC_DCHECK_EQ(0, ret);
2894 }
2895
2787 void Channel::SetRTCPStatus(bool enable) { 2896 void Channel::SetRTCPStatus(bool enable) {
2788 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 2897 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
2789 "Channel::SetRTCPStatus()"); 2898 "Channel::SetRTCPStatus()");
2790 _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff); 2899 _rtpRtcpModule->SetRTCPStatus(enable ? RtcpMode::kCompound : RtcpMode::kOff);
2791 } 2900 }
2792 2901
2902 void Channel::SetCongestionControlObjects(
2903 RtpPacketSender* rtp_packet_sender,
2904 TransportFeedbackObserver* transport_feedback_observer,
2905 PacketRouter* packet_router) {
2906 RTC_DCHECK(packet_sender_proxy_.get());
2907 RTC_DCHECK(packet_router != nullptr || packet_router_ != nullptr);
2908 packet_sender_proxy_->SetCongestionControlObjects(
2909 rtp_packet_sender, transport_feedback_observer, packet_router);
2910 _rtpRtcpModule->SetStorePacketsStatus(rtp_packet_sender != nullptr, 600);
2911 if (packet_router != nullptr) {
2912 packet_router->AddRtpModule(_rtpRtcpModule.get());
2913 } else {
2914 packet_router_->RemoveRtpModule(_rtpRtcpModule.get());
2915 }
2916 packet_router_ = packet_router;
2917 }
2918
2793 int 2919 int
2794 Channel::GetRTCPStatus(bool& enabled) 2920 Channel::GetRTCPStatus(bool& enabled)
2795 { 2921 {
2796 RtcpMode method = _rtpRtcpModule->RTCP(); 2922 RtcpMode method = _rtpRtcpModule->RTCP();
2797 enabled = (method != RtcpMode::kOff); 2923 enabled = (method != RtcpMode::kOff);
2798 return 0; 2924 return 0;
2799 } 2925 }
2800 2926
2801 int 2927 int
2802 Channel::SetRTCP_CNAME(const char cName[256]) 2928 Channel::SetRTCP_CNAME(const char cName[256])
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3942 int64_t min_rtt = 0; 4068 int64_t min_rtt = 0;
3943 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) 4069 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt)
3944 != 0) { 4070 != 0) {
3945 return 0; 4071 return 0;
3946 } 4072 }
3947 return rtt; 4073 return rtt;
3948 } 4074 }
3949 4075
3950 } // namespace voe 4076 } // namespace voe
3951 } // namespace webrtc 4077 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698