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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 2589713003: Make |rtcp_send_transport| mandatory in FlexfecReceiveStream::Config. (Closed)
Patch Set: Rebase. Created 3 years, 11 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/media/engine/webrtcvideoengine2.h ('k') | webrtc/test/call_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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 receive_streams_.erase(prev_stream); 1176 receive_streams_.erase(prev_stream);
1177 } 1177 }
1178 1178
1179 if (!ValidateReceiveSsrcAvailability(sp)) 1179 if (!ValidateReceiveSsrcAvailability(sp))
1180 return false; 1180 return false;
1181 1181
1182 for (uint32_t used_ssrc : sp.ssrcs) 1182 for (uint32_t used_ssrc : sp.ssrcs)
1183 receive_ssrcs_.insert(used_ssrc); 1183 receive_ssrcs_.insert(used_ssrc);
1184 1184
1185 webrtc::VideoReceiveStream::Config config(this); 1185 webrtc::VideoReceiveStream::Config config(this);
1186 webrtc::FlexfecConfig flexfec_config; 1186 webrtc::FlexfecReceiveStream::Config flexfec_config(this);
1187 ConfigureReceiverRtp(&config, &flexfec_config, sp); 1187 ConfigureReceiverRtp(&config, &flexfec_config, sp);
1188 1188
1189 // Set up A/V sync group based on sync label. 1189 // Set up A/V sync group based on sync label.
1190 config.sync_group = sp.sync_label; 1190 config.sync_group = sp.sync_label;
1191
1192 config.rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false;
1193 config.rtp.transport_cc =
1194 send_codec_ ? HasTransportCc(send_codec_->codec) : false;
1195 config.disable_prerenderer_smoothing = 1191 config.disable_prerenderer_smoothing =
1196 video_config_.disable_prerenderer_smoothing; 1192 video_config_.disable_prerenderer_smoothing;
1197 1193
1198 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( 1194 receive_streams_[ssrc] = new WebRtcVideoReceiveStream(
1199 call_, sp, std::move(config), external_decoder_factory_, default_stream, 1195 call_, sp, std::move(config), external_decoder_factory_, default_stream,
1200 recv_codecs_, flexfec_config); 1196 recv_codecs_, flexfec_config);
1201 1197
1202 return true; 1198 return true;
1203 } 1199 }
1204 1200
1205 void WebRtcVideoChannel2::ConfigureReceiverRtp( 1201 void WebRtcVideoChannel2::ConfigureReceiverRtp(
1206 webrtc::VideoReceiveStream::Config* config, 1202 webrtc::VideoReceiveStream::Config* config,
1207 webrtc::FlexfecConfig* flexfec_config, 1203 webrtc::FlexfecReceiveStream::Config* flexfec_config,
1208 const StreamParams& sp) const { 1204 const StreamParams& sp) const {
1209 uint32_t ssrc = sp.first_ssrc(); 1205 uint32_t ssrc = sp.first_ssrc();
1210 1206
1211 config->rtp.remote_ssrc = ssrc; 1207 config->rtp.remote_ssrc = ssrc;
1212 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; 1208 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_;
1213 1209
1214 config->rtp.extensions = recv_rtp_extensions_; 1210 config->rtp.extensions = recv_rtp_extensions_;
1215 // Whether or not the receive stream sends reduced size RTCP is determined 1211 // Whether or not the receive stream sends reduced size RTCP is determined
1216 // by the send params. 1212 // by the send params.
1217 // TODO(deadbeef): Once we change "send_params" to "sender_params" and 1213 // TODO(deadbeef): Once we change "send_params" to "sender_params" and
1218 // "recv_params" to "receiver_params", we should get this out of 1214 // "recv_params" to "receiver_params", we should get this out of
1219 // receiver_params_. 1215 // receiver_params_.
1220 config->rtp.rtcp_mode = send_params_.rtcp.reduced_size 1216 config->rtp.rtcp_mode = send_params_.rtcp.reduced_size
1221 ? webrtc::RtcpMode::kReducedSize 1217 ? webrtc::RtcpMode::kReducedSize
1222 : webrtc::RtcpMode::kCompound; 1218 : webrtc::RtcpMode::kCompound;
1223 1219
1224 // TODO(pbos): This protection is against setting the same local ssrc as 1220 // TODO(pbos): This protection is against setting the same local ssrc as
1225 // remote which is not permitted by the lower-level API. RTCP requires a 1221 // remote which is not permitted by the lower-level API. RTCP requires a
1226 // corresponding sender SSRC. Figure out what to do when we don't have 1222 // corresponding sender SSRC. Figure out what to do when we don't have
1227 // (receive-only) or know a good local SSRC. 1223 // (receive-only) or know a good local SSRC.
1228 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { 1224 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) {
1229 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { 1225 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) {
1230 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; 1226 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc;
1231 } else { 1227 } else {
1232 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; 1228 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1;
1233 } 1229 }
1234 } 1230 }
1235 1231
1232 config->rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false;
1233 config->rtp.transport_cc =
1234 send_codec_ ? HasTransportCc(send_codec_->codec) : false;
1235
1236 for (size_t i = 0; i < recv_codecs_.size(); ++i) { 1236 for (size_t i = 0; i < recv_codecs_.size(); ++i) {
1237 uint32_t rtx_ssrc; 1237 uint32_t rtx_ssrc;
1238 if (recv_codecs_[i].rtx_payload_type != -1 && 1238 if (recv_codecs_[i].rtx_payload_type != -1 &&
1239 sp.GetFidSsrc(ssrc, &rtx_ssrc)) { 1239 sp.GetFidSsrc(ssrc, &rtx_ssrc)) {
1240 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = 1240 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx =
1241 config->rtp.rtx[recv_codecs_[i].codec.id]; 1241 config->rtp.rtx[recv_codecs_[i].codec.id];
1242 rtx.ssrc = rtx_ssrc; 1242 rtx.ssrc = rtx_ssrc;
1243 rtx.payload_type = recv_codecs_[i].rtx_payload_type; 1243 rtx.payload_type = recv_codecs_[i].rtx_payload_type;
1244 } 1244 }
1245 } 1245 }
1246 1246
1247 // TODO(brandtr): This code needs to be generalized when we add support for 1247 // TODO(brandtr): This code needs to be generalized when we add support for
1248 // multistream protection. 1248 // multistream protection.
1249 uint32_t flexfec_ssrc; 1249 if (sp.GetFecFrSsrc(ssrc, &flexfec_config->remote_ssrc)) {
1250 if (sp.GetFecFrSsrc(ssrc, &flexfec_ssrc)) {
1251 flexfec_config->flexfec_ssrc = flexfec_ssrc;
1252 flexfec_config->protected_media_ssrcs = {ssrc}; 1250 flexfec_config->protected_media_ssrcs = {ssrc};
1251 flexfec_config->local_ssrc = config->rtp.local_ssrc;
1252 flexfec_config->rtcp_mode = config->rtp.rtcp_mode;
1253 flexfec_config->transport_cc = config->rtp.transport_cc;
1254 flexfec_config->rtp_header_extensions = config->rtp.extensions;
1253 } 1255 }
1254 } 1256 }
1255 1257
1256 bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) { 1258 bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) {
1257 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; 1259 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc;
1258 if (ssrc == 0) { 1260 if (ssrc == 0) {
1259 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; 1261 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported.";
1260 return false; 1262 return false;
1261 } 1263 }
1262 1264
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 UpdateSendState(); 2143 UpdateSendState();
2142 } 2144 }
2143 2145
2144 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( 2146 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream(
2145 webrtc::Call* call, 2147 webrtc::Call* call,
2146 const StreamParams& sp, 2148 const StreamParams& sp,
2147 webrtc::VideoReceiveStream::Config config, 2149 webrtc::VideoReceiveStream::Config config,
2148 WebRtcVideoDecoderFactory* external_decoder_factory, 2150 WebRtcVideoDecoderFactory* external_decoder_factory,
2149 bool default_stream, 2151 bool default_stream,
2150 const std::vector<VideoCodecSettings>& recv_codecs, 2152 const std::vector<VideoCodecSettings>& recv_codecs,
2151 const webrtc::FlexfecConfig& flexfec_config) 2153 const webrtc::FlexfecReceiveStream::Config& flexfec_config)
2152 : call_(call), 2154 : call_(call),
2153 stream_params_(sp), 2155 stream_params_(sp),
2154 stream_(NULL), 2156 stream_(NULL),
2155 default_stream_(default_stream), 2157 default_stream_(default_stream),
2156 config_(std::move(config)), 2158 config_(std::move(config)),
2157 flexfec_config_(flexfec_config), 2159 flexfec_config_(flexfec_config),
2158 flexfec_stream_(nullptr), 2160 flexfec_stream_(nullptr),
2159 external_decoder_factory_(external_decoder_factory), 2161 external_decoder_factory_(external_decoder_factory),
2160 sink_(NULL), 2162 sink_(NULL),
2161 first_frame_timestamp_(-1), 2163 first_frame_timestamp_(-1),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 webrtc::VideoReceiveStream::Decoder decoder; 2252 webrtc::VideoReceiveStream::Decoder decoder;
2251 decoder.decoder = allocated_decoder.decoder; 2253 decoder.decoder = allocated_decoder.decoder;
2252 decoder.payload_type = recv_codecs[i].codec.id; 2254 decoder.payload_type = recv_codecs[i].codec.id;
2253 decoder.payload_name = recv_codecs[i].codec.name; 2255 decoder.payload_name = recv_codecs[i].codec.name;
2254 decoder.codec_params = recv_codecs[i].codec.params; 2256 decoder.codec_params = recv_codecs[i].codec.params;
2255 config_.decoders.push_back(decoder); 2257 config_.decoders.push_back(decoder);
2256 } 2258 }
2257 2259
2258 // TODO(pbos): Reconfigure RTX based on incoming recv_codecs. 2260 // TODO(pbos): Reconfigure RTX based on incoming recv_codecs.
2259 config_.rtp.ulpfec = recv_codecs.front().ulpfec; 2261 config_.rtp.ulpfec = recv_codecs.front().ulpfec;
2260 flexfec_config_.flexfec_payload_type = 2262 flexfec_config_.payload_type = recv_codecs.front().flexfec_payload_type;
2261 recv_codecs.front().flexfec_payload_type;
2262 2263
2263 config_.rtp.nack.rtp_history_ms = 2264 config_.rtp.nack.rtp_history_ms =
2264 HasNack(recv_codecs.begin()->codec) ? kNackHistoryMs : 0; 2265 HasNack(recv_codecs.begin()->codec) ? kNackHistoryMs : 0;
2265 } 2266 }
2266 2267
2267 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetLocalSsrc( 2268 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetLocalSsrc(
2268 uint32_t local_ssrc) { 2269 uint32_t local_ssrc) {
2269 // TODO(pbos): Consider turning this sanity check into a RTC_DCHECK. You 2270 // TODO(pbos): Consider turning this sanity check into a RTC_DCHECK. You
2270 // should not be able to create a sender with the same SSRC as a receiver, but 2271 // should not be able to create a sender with the same SSRC as a receiver, but
2271 // right now this can't be done due to unittests depending on receiving what 2272 // right now this can't be done due to unittests depending on receiving what
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 if (flexfec_stream_) { 2335 if (flexfec_stream_) {
2335 call_->DestroyFlexfecReceiveStream(flexfec_stream_); 2336 call_->DestroyFlexfecReceiveStream(flexfec_stream_);
2336 flexfec_stream_ = nullptr; 2337 flexfec_stream_ = nullptr;
2337 } 2338 }
2338 if (stream_) { 2339 if (stream_) {
2339 call_->DestroyVideoReceiveStream(stream_); 2340 call_->DestroyVideoReceiveStream(stream_);
2340 } 2341 }
2341 stream_ = call_->CreateVideoReceiveStream(config_.Copy()); 2342 stream_ = call_->CreateVideoReceiveStream(config_.Copy());
2342 stream_->Start(); 2343 stream_->Start();
2343 if (IsFlexfecFieldTrialEnabled() && flexfec_config_.IsCompleteAndEnabled()) { 2344 if (IsFlexfecFieldTrialEnabled() && flexfec_config_.IsCompleteAndEnabled()) {
2344 webrtc::FlexfecReceiveStream::Config config; 2345 flexfec_stream_ = call_->CreateFlexfecReceiveStream(flexfec_config_);
2345 // Payload types and SSRCs come from the FlexFEC specific part of the SDP.
2346 config.payload_type = flexfec_config_.flexfec_payload_type;
2347 config.remote_ssrc = flexfec_config_.flexfec_ssrc;
2348 config.protected_media_ssrcs = flexfec_config_.protected_media_ssrcs;
2349 // RTCP messages and RTP header extensions apply to the entire track
2350 // in the SDP.
2351 config.transport_cc = config_.rtp.transport_cc;
2352 config.rtp_header_extensions = config_.rtp.extensions;
2353 flexfec_stream_ = call_->CreateFlexfecReceiveStream(config);
2354 flexfec_stream_->Start(); 2346 flexfec_stream_->Start();
2355 } 2347 }
2356 } 2348 }
2357 2349
2358 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ClearDecoders( 2350 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ClearDecoders(
2359 std::vector<AllocatedDecoder>* allocated_decoders) { 2351 std::vector<AllocatedDecoder>* allocated_decoders) {
2360 for (size_t i = 0; i < allocated_decoders->size(); ++i) { 2352 for (size_t i = 0; i < allocated_decoders->size(); ++i) {
2361 if ((*allocated_decoders)[i].external) { 2353 if ((*allocated_decoders)[i].external) {
2362 external_decoder_factory_->DestroyVideoDecoder( 2354 external_decoder_factory_->DestroyVideoDecoder(
2363 (*allocated_decoders)[i].external_decoder); 2355 (*allocated_decoders)[i].external_decoder);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 rtx_mapping[video_codecs[i].codec.id] != 2567 rtx_mapping[video_codecs[i].codec.id] !=
2576 ulpfec_config.red_payload_type) { 2568 ulpfec_config.red_payload_type) {
2577 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2569 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2578 } 2570 }
2579 } 2571 }
2580 2572
2581 return video_codecs; 2573 return video_codecs;
2582 } 2574 }
2583 2575
2584 } // namespace cricket 2576 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/test/call_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698