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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(kKeyFrameReqPliRtcp); | 151 rtp_rtcp_modules_[0]->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); |
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], sender_); | 156 packet_router_->AddRtpModule(rtp_rtcp_modules_[0], sender_); |
157 if (sender_) { | 157 if (sender_) { |
158 std::list<RtpRtcp*> send_rtp_modules(1, rtp_rtcp_modules_[0]); | 158 send_payload_router_->SetSendingRtpModules( |
159 send_payload_router_->SetSendingRtpModules(send_rtp_modules); | 159 std::vector<RtpRtcp*>(1, rtp_rtcp_modules_[0])); |
160 RTC_DCHECK(!send_payload_router_->active()); | 160 RTC_DCHECK(!send_payload_router_->active()); |
161 } else { | 161 } else { |
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); |
168 vcm_->SetRenderDelay(kDefaultRenderDelayMs); | 168 vcm_->SetRenderDelay(kDefaultRenderDelayMs); |
169 module_process_thread_->RegisterModule(&vie_sync_); | 169 module_process_thread_->RegisterModule(&vie_sync_); |
170 } | 170 } |
171 return 0; | 171 return 0; |
172 } | 172 } |
173 | 173 |
174 ViEChannel::~ViEChannel() { | 174 ViEChannel::~ViEChannel() { |
175 UpdateHistograms(); | 175 UpdateHistograms(); |
176 // Make sure we don't get more callbacks from the RTP module. | 176 // Make sure we don't get more callbacks from the RTP module. |
177 module_process_thread_->DeRegisterModule( | 177 module_process_thread_->DeRegisterModule( |
178 vie_receiver_.GetReceiveStatistics()); | 178 vie_receiver_.GetReceiveStatistics()); |
179 if (sender_) { | 179 if (sender_) { |
180 send_payload_router_->SetSendingRtpModules(std::list<RtpRtcp*>()); | 180 send_payload_router_->SetSendingRtpModules(std::vector<RtpRtcp*>()); |
181 } else { | 181 } else { |
182 module_process_thread_->DeRegisterModule(&vie_sync_); | 182 module_process_thread_->DeRegisterModule(&vie_sync_); |
183 } | 183 } |
184 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i) | 184 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i) |
185 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); | 185 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); |
186 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 186 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
187 module_process_thread_->DeRegisterModule(rtp_rtcp); | 187 module_process_thread_->DeRegisterModule(rtp_rtcp); |
188 delete rtp_rtcp; | 188 delete rtp_rtcp; |
189 } | 189 } |
190 } | 190 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 return -1; | 338 return -1; |
339 } | 339 } |
340 // Update the RTP module with the settings. | 340 // Update the RTP module with the settings. |
341 // Stop and Start the RTP module -> trigger new SSRC, if an SSRC hasn't been | 341 // Stop and Start the RTP module -> trigger new SSRC, if an SSRC hasn't been |
342 // set explicitly. | 342 // set explicitly. |
343 // The first layer is always active, so the first module can be checked for | 343 // The first layer is always active, so the first module can be checked for |
344 // sending status. | 344 // sending status. |
345 bool is_sending = rtp_rtcp_modules_[0]->Sending(); | 345 bool is_sending = rtp_rtcp_modules_[0]->Sending(); |
346 bool router_was_active = send_payload_router_->active(); | 346 bool router_was_active = send_payload_router_->active(); |
347 send_payload_router_->set_active(false); | 347 send_payload_router_->set_active(false); |
348 send_payload_router_->SetSendingRtpModules(std::list<RtpRtcp*>()); | 348 send_payload_router_->SetSendingRtpModules(std::vector<RtpRtcp*>()); |
349 | 349 |
350 std::vector<RtpRtcp*> registered_modules; | 350 std::vector<RtpRtcp*> registered_modules; |
351 std::vector<RtpRtcp*> deregistered_modules; | 351 std::vector<RtpRtcp*> deregistered_modules; |
352 size_t num_active_modules = video_codec.numberOfSimulcastStreams > 0 | 352 size_t num_active_modules = video_codec.numberOfSimulcastStreams > 0 |
353 ? video_codec.numberOfSimulcastStreams | 353 ? video_codec.numberOfSimulcastStreams |
354 : 1; | 354 : 1; |
355 size_t num_prev_active_modules; | 355 size_t num_prev_active_modules; |
356 { | 356 { |
357 // Cache which modules are active so StartSend can know which ones to start. | 357 // Cache which modules are active so StartSend can know which ones to start. |
358 rtc::CritScope lock(&crit_); | 358 rtc::CritScope lock(&crit_); |
(...skipping 20 matching lines...) Expand all Loading... | |
379 } | 379 } |
380 rtp_rtcp->SetSendingStatus(is_sending); | 380 rtp_rtcp->SetSendingStatus(is_sending); |
381 rtp_rtcp->SetSendingMediaStatus(is_sending); | 381 rtp_rtcp->SetSendingMediaStatus(is_sending); |
382 } | 382 } |
383 | 383 |
384 // |RegisterSimulcastRtpRtcpModules| resets all old weak pointers and old | 384 // |RegisterSimulcastRtpRtcpModules| resets all old weak pointers and old |
385 // modules can be deleted after this step. | 385 // modules can be deleted after this step. |
386 vie_receiver_.RegisterRtpRtcpModules(registered_modules); | 386 vie_receiver_.RegisterRtpRtcpModules(registered_modules); |
387 | 387 |
388 // Update the packet and payload routers with the sending RtpRtcp modules. | 388 // Update the packet and payload routers with the sending RtpRtcp modules. |
389 if (sender_) { | 389 send_payload_router_->SetSendingRtpModules(registered_modules); |
danilchap
2016/02/11 16:22:07
why drop if(sender_) ?
pbos-webrtc
2016/02/11 16:38:31
DCHECKed above.
| |
390 std::list<RtpRtcp*> active_send_modules; | |
391 for (RtpRtcp* rtp_rtcp : registered_modules) | |
392 active_send_modules.push_back(rtp_rtcp); | |
393 send_payload_router_->SetSendingRtpModules(active_send_modules); | |
394 } | |
395 | 390 |
396 if (router_was_active) | 391 if (router_was_active) |
397 send_payload_router_->set_active(true); | 392 send_payload_router_->set_active(true); |
398 | 393 |
399 // Deregister previously registered modules. | 394 // Deregister previously registered modules. |
400 for (size_t i = num_active_modules; i < num_prev_active_modules; ++i) { | 395 for (size_t i = num_active_modules; i < num_prev_active_modules; ++i) { |
401 module_process_thread_->DeRegisterModule(rtp_rtcp_modules_[i]); | 396 module_process_thread_->DeRegisterModule(rtp_rtcp_modules_[i]); |
402 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); | 397 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); |
403 } | 398 } |
404 // Register new active modules. | 399 // Register new active modules. |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1051 rtc::CritScope lock(&crit_); | 1046 rtc::CritScope lock(&crit_); |
1052 receive_stats_callback_ = receive_statistics_proxy; | 1047 receive_stats_callback_ = receive_statistics_proxy; |
1053 } | 1048 } |
1054 | 1049 |
1055 void ViEChannel::SetIncomingVideoStream( | 1050 void ViEChannel::SetIncomingVideoStream( |
1056 IncomingVideoStream* incoming_video_stream) { | 1051 IncomingVideoStream* incoming_video_stream) { |
1057 rtc::CritScope lock(&crit_); | 1052 rtc::CritScope lock(&crit_); |
1058 incoming_video_stream_ = incoming_video_stream; | 1053 incoming_video_stream_ = incoming_video_stream; |
1059 } | 1054 } |
1060 } // namespace webrtc | 1055 } // namespace webrtc |
OLD | NEW |