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

Side by Side Diff: webrtc/video_engine/vie_channel.cc

Issue 1329083005: Add TransportFeedback adapter, adapting remote feedback to bwe estiamtor (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months 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
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ViEChannel* owner_; 77 ViEChannel* owner_;
78 }; 78 };
79 79
80 ViEChannel::ViEChannel(int32_t channel_id, 80 ViEChannel::ViEChannel(int32_t channel_id,
81 int32_t engine_id, 81 int32_t engine_id,
82 uint32_t number_of_cores, 82 uint32_t number_of_cores,
83 Transport* transport, 83 Transport* transport,
84 ProcessThread* module_process_thread, 84 ProcessThread* module_process_thread,
85 RtcpIntraFrameObserver* intra_frame_observer, 85 RtcpIntraFrameObserver* intra_frame_observer,
86 RtcpBandwidthObserver* bandwidth_observer, 86 RtcpBandwidthObserver* bandwidth_observer,
87 SendTimeObserver* send_time_observer, 87 TransportFeedbackObserver* transport_feedback_observer,
88 RemoteBitrateEstimator* remote_bitrate_estimator, 88 RemoteBitrateEstimator* remote_bitrate_estimator,
89 RtcpRttStats* rtt_stats, 89 RtcpRttStats* rtt_stats,
90 PacedSender* paced_sender, 90 PacedSender* paced_sender,
91 PacketRouter* packet_router, 91 PacketRouter* packet_router,
92 size_t max_rtp_streams, 92 size_t max_rtp_streams,
93 bool sender) 93 bool sender)
94 : channel_id_(channel_id), 94 : channel_id_(channel_id),
95 engine_id_(engine_id), 95 engine_id_(engine_id),
96 number_of_cores_(number_of_cores), 96 number_of_cores_(number_of_cores),
97 sender_(sender), 97 sender_(sender),
98 module_process_thread_(module_process_thread), 98 module_process_thread_(module_process_thread),
99 crit_(CriticalSectionWrapper::CreateCriticalSection()), 99 crit_(CriticalSectionWrapper::CreateCriticalSection()),
100 send_payload_router_(new PayloadRouter()), 100 send_payload_router_(new PayloadRouter()),
101 vcm_protection_callback_(new ViEChannelProtectionCallback(this)), 101 vcm_protection_callback_(new ViEChannelProtectionCallback(this)),
102 vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(), 102 vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(),
103 nullptr, 103 nullptr,
104 nullptr)), 104 nullptr)),
105 vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this), 105 vie_receiver_(channel_id, vcm_, remote_bitrate_estimator, this),
106 vie_sync_(vcm_), 106 vie_sync_(vcm_),
107 stats_observer_(new ChannelStatsObserver(this)), 107 stats_observer_(new ChannelStatsObserver(this)),
108 receive_stats_callback_(nullptr), 108 receive_stats_callback_(nullptr),
109 incoming_video_stream_(nullptr), 109 incoming_video_stream_(nullptr),
110 intra_frame_observer_(intra_frame_observer), 110 intra_frame_observer_(intra_frame_observer),
111 rtt_stats_(rtt_stats), 111 rtt_stats_(rtt_stats),
112 paced_sender_(paced_sender), 112 paced_sender_(paced_sender),
113 packet_router_(packet_router), 113 packet_router_(packet_router),
114 bandwidth_observer_(bandwidth_observer), 114 bandwidth_observer_(bandwidth_observer),
115 send_time_observer_(send_time_observer), 115 transport_feedback_observer_(transport_feedback_observer),
116 nack_history_size_sender_(kSendSidePacketHistorySize), 116 nack_history_size_sender_(kSendSidePacketHistorySize),
117 max_nack_reordering_threshold_(kMaxPacketAgeToNack), 117 max_nack_reordering_threshold_(kMaxPacketAgeToNack),
118 pre_render_callback_(NULL), 118 pre_render_callback_(NULL),
119 report_block_stats_sender_(new ReportBlockStats()), 119 report_block_stats_sender_(new ReportBlockStats()),
120 time_of_first_rtt_ms_(-1), 120 time_of_first_rtt_ms_(-1),
121 rtt_sum_ms_(0), 121 rtt_sum_ms_(0),
122 num_rtts_(0), 122 num_rtts_(0),
123 rtp_rtcp_modules_( 123 rtp_rtcp_modules_(
124 CreateRtpRtcpModules(ViEModuleId(engine_id_, channel_id_), 124 CreateRtpRtcpModules(ViEModuleId(engine_id_, channel_id_),
125 !sender, 125 !sender,
126 vie_receiver_.GetReceiveStatistics(), 126 vie_receiver_.GetReceiveStatistics(),
127 transport, 127 transport,
128 sender ? intra_frame_observer_ : nullptr, 128 sender ? intra_frame_observer_ : nullptr,
129 sender ? bandwidth_observer_.get() : nullptr, 129 sender ? bandwidth_observer_.get() : nullptr,
130 sender ? send_time_observer_ : nullptr, 130 transport_feedback_observer_,
131 rtt_stats_, 131 rtt_stats_,
132 &rtcp_packet_type_counter_observer_, 132 &rtcp_packet_type_counter_observer_,
133 remote_bitrate_estimator, 133 remote_bitrate_estimator,
134 paced_sender_, 134 paced_sender_,
135 sender_ ? packet_router_ : nullptr, 135 packet_router_,
136 &send_bitrate_observer_, 136 &send_bitrate_observer_,
137 &send_frame_count_observer_, 137 &send_frame_count_observer_,
138 &send_side_delay_observer_, 138 &send_side_delay_observer_,
139 max_rtp_streams)), 139 max_rtp_streams)),
140 num_active_rtp_rtcp_modules_(1) { 140 num_active_rtp_rtcp_modules_(1) {
141 vie_receiver_.SetRtpRtcpModule(rtp_rtcp_modules_[0]); 141 vie_receiver_.SetRtpRtcpModule(rtp_rtcp_modules_[0]);
142 vcm_->SetNackSettings(kMaxNackListSize, max_nack_reordering_threshold_, 0); 142 vcm_->SetNackSettings(kMaxNackListSize, max_nack_reordering_threshold_, 0);
143 } 143 }
144 144
145 int32_t ViEChannel::Init() { 145 int32_t ViEChannel::Init() {
146 module_process_thread_->RegisterModule(vie_receiver_.GetReceiveStatistics()); 146 module_process_thread_->RegisterModule(vie_receiver_.GetReceiveStatistics());
147 147
148 // RTP/RTCP initialization. 148 // RTP/RTCP initialization.
149 module_process_thread_->RegisterModule(rtp_rtcp_modules_[0]); 149 module_process_thread_->RegisterModule(rtp_rtcp_modules_[0]);
150 150
151 rtp_rtcp_modules_[0]->SetKeyFrameRequestMethod(kKeyFrameReqFirRtp); 151 rtp_rtcp_modules_[0]->SetKeyFrameRequestMethod(kKeyFrameReqFirRtp);
152 if (paced_sender_) { 152 if (paced_sender_) {
153 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) 153 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
154 rtp_rtcp->SetStorePacketsStatus(true, nack_history_size_sender_); 154 rtp_rtcp->SetStorePacketsStatus(true, nack_history_size_sender_);
155 } 155 }
156 packet_router_->AddRtpModule(rtp_rtcp_modules_[0]);
156 if (sender_) { 157 if (sender_) {
157 packet_router_->AddRtpModule(rtp_rtcp_modules_[0]);
158 std::list<RtpRtcp*> send_rtp_modules(1, rtp_rtcp_modules_[0]); 158 std::list<RtpRtcp*> send_rtp_modules(1, rtp_rtcp_modules_[0]);
159 send_payload_router_->SetSendingRtpModules(send_rtp_modules); 159 send_payload_router_->SetSendingRtpModules(send_rtp_modules);
160 DCHECK(!send_payload_router_->active()); 160 DCHECK(!send_payload_router_->active());
161 } 161 }
162 if (vcm_->RegisterReceiveCallback(this) != 0) { 162 if (vcm_->RegisterReceiveCallback(this) != 0) {
163 return -1; 163 return -1;
164 } 164 }
165 vcm_->RegisterFrameTypeCallback(this); 165 vcm_->RegisterFrameTypeCallback(this);
166 vcm_->RegisterReceiveStatisticsCallback(this); 166 vcm_->RegisterReceiveStatisticsCallback(this);
167 vcm_->RegisterDecoderTimingCallback(this); 167 vcm_->RegisterDecoderTimingCallback(this);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 return 0; 1135 return 0;
1136 } 1136 }
1137 1137
1138 std::vector<RtpRtcp*> ViEChannel::CreateRtpRtcpModules( 1138 std::vector<RtpRtcp*> ViEChannel::CreateRtpRtcpModules(
1139 int32_t id, 1139 int32_t id,
1140 bool receiver_only, 1140 bool receiver_only,
1141 ReceiveStatistics* receive_statistics, 1141 ReceiveStatistics* receive_statistics,
1142 Transport* outgoing_transport, 1142 Transport* outgoing_transport,
1143 RtcpIntraFrameObserver* intra_frame_callback, 1143 RtcpIntraFrameObserver* intra_frame_callback,
1144 RtcpBandwidthObserver* bandwidth_callback, 1144 RtcpBandwidthObserver* bandwidth_callback,
1145 SendTimeObserver* send_time_callback, 1145 TransportFeedbackObserver* transport_feedback_callback,
1146 RtcpRttStats* rtt_stats, 1146 RtcpRttStats* rtt_stats,
1147 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer, 1147 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
1148 RemoteBitrateEstimator* remote_bitrate_estimator, 1148 RemoteBitrateEstimator* remote_bitrate_estimator,
1149 PacedSender* paced_sender, 1149 PacedSender* paced_sender,
1150 PacketRouter* packet_router, 1150 PacketRouter* packet_router,
1151 BitrateStatisticsObserver* send_bitrate_observer, 1151 BitrateStatisticsObserver* send_bitrate_observer,
1152 FrameCountObserver* send_frame_count_observer, 1152 FrameCountObserver* send_frame_count_observer,
1153 SendSideDelayObserver* send_side_delay_observer, 1153 SendSideDelayObserver* send_side_delay_observer,
1154 size_t num_modules) { 1154 size_t num_modules) {
1155 DCHECK_GT(num_modules, 0u); 1155 DCHECK_GT(num_modules, 0u);
1156 RtpRtcp::Configuration configuration; 1156 RtpRtcp::Configuration configuration;
1157 ReceiveStatistics* null_receive_statistics = configuration.receive_statistics; 1157 ReceiveStatistics* null_receive_statistics = configuration.receive_statistics;
1158 configuration.id = id; 1158 configuration.id = id;
1159 configuration.audio = false; 1159 configuration.audio = false;
1160 configuration.receiver_only = receiver_only; 1160 configuration.receiver_only = receiver_only;
1161 configuration.receive_statistics = receive_statistics; 1161 configuration.receive_statistics = receive_statistics;
1162 configuration.outgoing_transport = outgoing_transport; 1162 configuration.outgoing_transport = outgoing_transport;
1163 configuration.intra_frame_callback = intra_frame_callback; 1163 configuration.intra_frame_callback = intra_frame_callback;
1164 configuration.rtt_stats = rtt_stats; 1164 configuration.rtt_stats = rtt_stats;
1165 configuration.rtcp_packet_type_counter_observer = 1165 configuration.rtcp_packet_type_counter_observer =
1166 rtcp_packet_type_counter_observer; 1166 rtcp_packet_type_counter_observer;
1167 configuration.paced_sender = paced_sender; 1167 configuration.paced_sender = paced_sender;
1168 configuration.packet_router = packet_router; 1168 configuration.packet_router = packet_router;
1169 configuration.send_bitrate_observer = send_bitrate_observer; 1169 configuration.send_bitrate_observer = send_bitrate_observer;
1170 configuration.send_frame_count_observer = send_frame_count_observer; 1170 configuration.send_frame_count_observer = send_frame_count_observer;
1171 configuration.send_side_delay_observer = send_side_delay_observer; 1171 configuration.send_side_delay_observer = send_side_delay_observer;
1172 configuration.bandwidth_callback = bandwidth_callback; 1172 configuration.bandwidth_callback = bandwidth_callback;
1173 configuration.send_time_callback = send_time_callback; 1173 configuration.transport_feedback_callback = transport_feedback_callback;
1174 1174
1175 std::vector<RtpRtcp*> modules; 1175 std::vector<RtpRtcp*> modules;
1176 for (size_t i = 0; i < num_modules; ++i) { 1176 for (size_t i = 0; i < num_modules; ++i) {
1177 RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration); 1177 RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration);
1178 rtp_rtcp->SetSendingStatus(false); 1178 rtp_rtcp->SetSendingStatus(false);
1179 rtp_rtcp->SetSendingMediaStatus(false); 1179 rtp_rtcp->SetSendingMediaStatus(false);
1180 rtp_rtcp->SetRTCPStatus(kRtcpCompound); 1180 rtp_rtcp->SetRTCPStatus(kRtcpCompound);
1181 modules.push_back(rtp_rtcp); 1181 modules.push_back(rtp_rtcp);
1182 // Receive statistics and remote bitrate estimator should only be set for 1182 // Receive statistics and remote bitrate estimator should only be set for
1183 // the primary (first) module. 1183 // the primary (first) module.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 CriticalSectionScoped cs(crit_.get()); 1268 CriticalSectionScoped cs(crit_.get());
1269 receive_stats_callback_ = receive_statistics_proxy; 1269 receive_stats_callback_ = receive_statistics_proxy;
1270 } 1270 }
1271 1271
1272 void ViEChannel::SetIncomingVideoStream( 1272 void ViEChannel::SetIncomingVideoStream(
1273 IncomingVideoStream* incoming_video_stream) { 1273 IncomingVideoStream* incoming_video_stream) {
1274 CriticalSectionScoped cs(crit_.get()); 1274 CriticalSectionScoped cs(crit_.get());
1275 incoming_video_stream_ = incoming_video_stream; 1275 incoming_video_stream_ = incoming_video_stream;
1276 } 1276 }
1277 } // namespace webrtc 1277 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698