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

Side by Side Diff: webrtc/video/rtp_stream_receiver.cc

Issue 2042603002: Movable support for VideoReceiveStream::Config and avoid copies (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add TODO Created 4 years, 6 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
« no previous file with comments | « webrtc/video/rtp_stream_receiver.h ('k') | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 static const int kPacketLogIntervalMs = 10000; 70 static const int kPacketLogIntervalMs = 10000;
71 71
72 RtpStreamReceiver::RtpStreamReceiver( 72 RtpStreamReceiver::RtpStreamReceiver(
73 vcm::VideoReceiver* video_receiver, 73 vcm::VideoReceiver* video_receiver,
74 RemoteBitrateEstimator* remote_bitrate_estimator, 74 RemoteBitrateEstimator* remote_bitrate_estimator,
75 Transport* transport, 75 Transport* transport,
76 RtcpRttStats* rtt_stats, 76 RtcpRttStats* rtt_stats,
77 PacedSender* paced_sender, 77 PacedSender* paced_sender,
78 PacketRouter* packet_router, 78 PacketRouter* packet_router,
79 VieRemb* remb, 79 VieRemb* remb,
80 const VideoReceiveStream::Config& config, 80 const VideoReceiveStream::Config* config,
81 ReceiveStatisticsProxy* receive_stats_proxy, 81 ReceiveStatisticsProxy* receive_stats_proxy,
82 ProcessThread* process_thread) 82 ProcessThread* process_thread)
83 : clock_(Clock::GetRealTimeClock()), 83 : clock_(Clock::GetRealTimeClock()),
84 config_(config), 84 config_(*config),
85 video_receiver_(video_receiver), 85 video_receiver_(video_receiver),
86 remote_bitrate_estimator_(remote_bitrate_estimator), 86 remote_bitrate_estimator_(remote_bitrate_estimator),
87 packet_router_(packet_router), 87 packet_router_(packet_router),
88 remb_(remb), 88 remb_(remb),
89 process_thread_(process_thread), 89 process_thread_(process_thread),
90 ntp_estimator_(clock_), 90 ntp_estimator_(clock_),
91 rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)), 91 rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)),
92 rtp_header_parser_(RtpHeaderParser::Create()), 92 rtp_header_parser_(RtpHeaderParser::Create()),
93 rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_, 93 rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_,
94 this, 94 this,
95 this, 95 this,
96 &rtp_payload_registry_)), 96 &rtp_payload_registry_)),
97 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), 97 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)),
98 fec_receiver_(FecReceiver::Create(this)), 98 fec_receiver_(FecReceiver::Create(this)),
99 receiving_(false), 99 receiving_(false),
100 restored_packet_in_use_(false), 100 restored_packet_in_use_(false),
101 last_packet_log_ms_(-1), 101 last_packet_log_ms_(-1),
102 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), 102 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(),
103 transport, 103 transport,
104 rtt_stats, 104 rtt_stats,
105 receive_stats_proxy, 105 receive_stats_proxy,
106 remote_bitrate_estimator_, 106 remote_bitrate_estimator_,
107 paced_sender, 107 paced_sender,
108 packet_router)) { 108 packet_router)) {
109 packet_router_->AddRtpModule(rtp_rtcp_.get()); 109 packet_router_->AddRtpModule(rtp_rtcp_.get());
110 rtp_receive_statistics_->RegisterRtpStatisticsCallback(receive_stats_proxy); 110 rtp_receive_statistics_->RegisterRtpStatisticsCallback(receive_stats_proxy);
111 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(receive_stats_proxy); 111 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(receive_stats_proxy);
112 112
113 RTC_DCHECK(config.rtp.rtcp_mode != RtcpMode::kOff) 113 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff)
114 << "A stream should not be configured with RTCP disabled. This value is " 114 << "A stream should not be configured with RTCP disabled. This value is "
115 "reserved for internal usage."; 115 "reserved for internal usage.";
116 RTC_DCHECK(config_.rtp.remote_ssrc != 0); 116 RTC_DCHECK(config_.rtp.remote_ssrc != 0);
117 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? 117 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams?
118 RTC_DCHECK(config_.rtp.local_ssrc != 0); 118 RTC_DCHECK(config_.rtp.local_ssrc != 0);
119 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc); 119 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc);
120 120
121 rtp_rtcp_->SetRTCPStatus(config.rtp.rtcp_mode); 121 rtp_rtcp_->SetRTCPStatus(config_.rtp.rtcp_mode);
122 rtp_rtcp_->SetSSRC(config.rtp.local_ssrc); 122 rtp_rtcp_->SetSSRC(config_.rtp.local_ssrc);
123 rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); 123 rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp);
124 if (config.rtp.remb) { 124 if (config_.rtp.remb) {
125 rtp_rtcp_->SetREMBStatus(true); 125 rtp_rtcp_->SetREMBStatus(true);
126 remb_->AddReceiveChannel(rtp_rtcp_.get()); 126 remb_->AddReceiveChannel(rtp_rtcp_.get());
127 } 127 }
128 128
129 for (size_t i = 0; i < config.rtp.extensions.size(); ++i) { 129 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
130 EnableReceiveRtpHeaderExtension(config.rtp.extensions[i].uri, 130 EnableReceiveRtpHeaderExtension(config_.rtp.extensions[i].uri,
131 config.rtp.extensions[i].id); 131 config_.rtp.extensions[i].id);
132 } 132 }
133 133
134 static const int kMaxPacketAgeToNack = 450; 134 static const int kMaxPacketAgeToNack = 450;
135 const int max_reordering_threshold = (config.rtp.nack.rtp_history_ms > 0) 135 const int max_reordering_threshold = (config_.rtp.nack.rtp_history_ms > 0)
136 ? kMaxPacketAgeToNack : kDefaultMaxReorderingThreshold; 136 ? kMaxPacketAgeToNack
137 : kDefaultMaxReorderingThreshold;
137 rtp_receive_statistics_->SetMaxReorderingThreshold(max_reordering_threshold); 138 rtp_receive_statistics_->SetMaxReorderingThreshold(max_reordering_threshold);
138 139
139 // TODO(pbos): Support multiple RTX, per video payload. 140 // TODO(pbos): Support multiple RTX, per video payload.
140 for (const auto& kv : config_.rtp.rtx) { 141 for (const auto& kv : config_.rtp.rtx) {
141 RTC_DCHECK(kv.second.ssrc != 0); 142 RTC_DCHECK(kv.second.ssrc != 0);
142 RTC_DCHECK(kv.second.payload_type != 0); 143 RTC_DCHECK(kv.second.payload_type != 0);
143 144
144 rtp_payload_registry_.SetRtxSsrc(kv.second.ssrc); 145 rtp_payload_registry_.SetRtxSsrc(kv.second.ssrc);
145 rtp_payload_registry_.SetRtxPayloadType(kv.second.payload_type, 146 rtp_payload_registry_.SetRtxPayloadType(kv.second.payload_type,
146 kv.first); 147 kv.first);
(...skipping 24 matching lines...) Expand all
171 rtp_payload_registry_.SetRtxPayloadType( 172 rtp_payload_registry_.SetRtxPayloadType(
172 config_.rtp.fec.red_rtx_payload_type, 173 config_.rtp.fec.red_rtx_payload_type,
173 config_.rtp.fec.red_payload_type); 174 config_.rtp.fec.red_payload_type);
174 } 175 }
175 176
176 rtp_rtcp_->SetGenericFECStatus(true, 177 rtp_rtcp_->SetGenericFECStatus(true,
177 config_.rtp.fec.red_payload_type, 178 config_.rtp.fec.red_payload_type,
178 config_.rtp.fec.ulpfec_payload_type); 179 config_.rtp.fec.ulpfec_payload_type);
179 } 180 }
180 181
181 if (config.rtp.rtcp_xr.receiver_reference_time_report) 182 if (config_.rtp.rtcp_xr.receiver_reference_time_report)
182 rtp_rtcp_->SetRtcpXrRrtrStatus(true); 183 rtp_rtcp_->SetRtcpXrRrtrStatus(true);
183 184
184 // Stats callback for CNAME changes. 185 // Stats callback for CNAME changes.
185 rtp_rtcp_->RegisterRtcpStatisticsCallback(receive_stats_proxy); 186 rtp_rtcp_->RegisterRtcpStatisticsCallback(receive_stats_proxy);
186 187
187 process_thread_->RegisterModule(rtp_receive_statistics_.get()); 188 process_thread_->RegisterModule(rtp_receive_statistics_.get());
188 process_thread_->RegisterModule(rtp_rtcp_.get()); 189 process_thread_->RegisterModule(rtp_rtcp_.get());
189 } 190 }
190 191
191 RtpStreamReceiver::~RtpStreamReceiver() { 192 RtpStreamReceiver::~RtpStreamReceiver() {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 const std::string& extension, int id) { 536 const std::string& extension, int id) {
536 // One-byte-extension local identifiers are in the range 1-14 inclusive. 537 // One-byte-extension local identifiers are in the range 1-14 inclusive.
537 RTC_DCHECK_GE(id, 1); 538 RTC_DCHECK_GE(id, 1);
538 RTC_DCHECK_LE(id, 14); 539 RTC_DCHECK_LE(id, 14);
539 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); 540 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension));
540 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( 541 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension(
541 StringToRtpExtensionType(extension), id)); 542 StringToRtpExtensionType(extension), id));
542 } 543 }
543 544
544 } // namespace webrtc 545 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/rtp_stream_receiver.h ('k') | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698