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

Unified Diff: webrtc/video/vie_channel.cc

Issue 1739283002: Remove add/removal of RTP modules in PacketRouter. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/vie_channel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_channel.cc
diff --git a/webrtc/video/vie_channel.cc b/webrtc/video/vie_channel.cc
index aa34d0dc0f6d98f09ad6afbcb08b20c1600c3f1b..30992868d1b9013436c5afe319f5bdfe0e33f63e 100644
--- a/webrtc/video/vie_channel.cc
+++ b/webrtc/video/vie_channel.cc
@@ -120,8 +120,7 @@ ViEChannel::ViEChannel(Transport* transport,
&send_bitrate_observer_,
&send_frame_count_observer_,
&send_side_delay_observer_,
- max_rtp_streams)),
- num_active_rtp_rtcp_modules_(1) {
+ max_rtp_streams)) {
vie_receiver_.SetRtpRtcpModule(rtp_rtcp_modules_[0]);
if (sender_) {
RTC_DCHECK(send_payload_router_);
@@ -138,15 +137,16 @@ int32_t ViEChannel::Init() {
module_process_thread_->RegisterModule(vie_receiver_.GetReceiveStatistics());
// RTP/RTCP initialization.
- for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
module_process_thread_->RegisterModule(rtp_rtcp);
+ packet_router_->AddRtpModule(rtp_rtcp);
+ }
rtp_rtcp_modules_[0]->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp);
if (paced_sender_) {
for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
rtp_rtcp->SetStorePacketsStatus(true, kMinSendSidePacketHistorySize);
}
- packet_router_->AddRtpModule(rtp_rtcp_modules_[0]);
if (sender_) {
send_payload_router_->SetSendingRtpModules(1);
RTC_DCHECK(!send_payload_router_->active());
@@ -170,9 +170,8 @@ ViEChannel::~ViEChannel() {
if (sender_) {
send_payload_router_->SetSendingRtpModules(0);
}
- for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i)
- packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i]);
for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
+ packet_router_->RemoveRtpModule(rtp_rtcp);
module_process_thread_->DeRegisterModule(rtp_rtcp);
delete rtp_rtcp;
}
@@ -250,13 +249,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
size_t num_active_modules = video_codec.numberOfSimulcastStreams > 0
? video_codec.numberOfSimulcastStreams
: 1;
- size_t num_prev_active_modules;
- {
- // Cache which modules are active so StartSend can know which ones to start.
- rtc::CritScope lock(&crit_);
- num_prev_active_modules = num_active_rtp_rtcp_modules_;
- num_active_rtp_rtcp_modules_ = num_active_modules;
- }
for (size_t i = 0; i < num_active_modules; ++i)
registered_modules.push_back(rtp_rtcp_modules_[i]);
@@ -269,12 +261,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
send_payload_router_->set_active(is_sending);
- // Deregister previously registered modules.
- for (size_t i = num_active_modules; i < num_prev_active_modules; ++i)
- packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i]);
- // Register new active modules.
- for (size_t i = num_prev_active_modules; i < num_active_modules; ++i)
- packet_router_->AddRtpModule(rtp_rtcp_modules_[i]);
return 0;
}
« no previous file with comments | « webrtc/video/vie_channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698