Chromium Code Reviews

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

Issue 2617373002: Reorder assignments in WebRtcVideoChannel2::ConfigureReceiverRtp to match definition in VideoReceiv… (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | 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 1168 matching lines...)
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::FlexfecConfig flexfec_config;
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.
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 = 1189 config.disable_prerenderer_smoothing =
1196 video_config_.disable_prerenderer_smoothing; 1190 video_config_.disable_prerenderer_smoothing;
1191 config.sync_group = sp.sync_label;
1197 1192
1198 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( 1193 receive_streams_[ssrc] = new WebRtcVideoReceiveStream(
1199 call_, sp, std::move(config), external_decoder_factory_, default_stream, 1194 call_, sp, std::move(config), external_decoder_factory_, default_stream,
1200 recv_codecs_, flexfec_config); 1195 recv_codecs_, flexfec_config);
1201 1196
1202 return true; 1197 return true;
1203 } 1198 }
1204 1199
1205 void WebRtcVideoChannel2::ConfigureReceiverRtp( 1200 void WebRtcVideoChannel2::ConfigureReceiverRtp(
1206 webrtc::VideoReceiveStream::Config* config, 1201 webrtc::VideoReceiveStream::Config* config,
1207 webrtc::FlexfecConfig* flexfec_config, 1202 webrtc::FlexfecConfig* flexfec_config,
1208 const StreamParams& sp) const { 1203 const StreamParams& sp) const {
1209 uint32_t ssrc = sp.first_ssrc(); 1204 uint32_t ssrc = sp.first_ssrc();
1210 1205
1211 config->rtp.remote_ssrc = ssrc; 1206 config->rtp.remote_ssrc = ssrc;
1212 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; 1207 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_;
1213 1208
1214 config->rtp.extensions = recv_rtp_extensions_;
1215 // Whether or not the receive stream sends reduced size RTCP is determined
1216 // by the send params.
1217 // TODO(deadbeef): Once we change "send_params" to "sender_params" and
1218 // "recv_params" to "receiver_params", we should get this out of
1219 // receiver_params_.
1220 config->rtp.rtcp_mode = send_params_.rtcp.reduced_size
1221 ? webrtc::RtcpMode::kReducedSize
1222 : webrtc::RtcpMode::kCompound;
1223
1224 // TODO(pbos): This protection is against setting the same local ssrc as 1209 // 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 1210 // 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 1211 // corresponding sender SSRC. Figure out what to do when we don't have
1227 // (receive-only) or know a good local SSRC. 1212 // (receive-only) or know a good local SSRC.
1228 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { 1213 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) {
1229 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { 1214 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) {
1230 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; 1215 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc;
1231 } else { 1216 } else {
1232 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; 1217 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1;
1233 } 1218 }
1234 } 1219 }
1235 1220
1221 // Whether or not the receive stream sends reduced size RTCP is determined
1222 // by the send params.
1223 // TODO(deadbeef): Once we change "send_params" to "sender_params" and
1224 // "recv_params" to "receiver_params", we should get this out of
1225 // receiver_params_.
1226 config->rtp.rtcp_mode = send_params_.rtcp.reduced_size
1227 ? webrtc::RtcpMode::kReducedSize
1228 : webrtc::RtcpMode::kCompound;
1229
1230 config->rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false;
1231 config->rtp.transport_cc =
1232 send_codec_ ? HasTransportCc(send_codec_->codec) : false;
1233
1234 // TODO(brandtr): Generalize when we add support for multistream protection.
1235 uint32_t flexfec_ssrc;
1236 if (sp.GetFecFrSsrc(ssrc, &flexfec_ssrc)) {
1237 flexfec_config->flexfec_ssrc = flexfec_ssrc;
brandtr 2017/01/09 11:45:28 In another CL (https://codereview.webrtc.org/25897
1238 flexfec_config->protected_media_ssrcs = {ssrc};
1239 }
1240
1236 for (size_t i = 0; i < recv_codecs_.size(); ++i) { 1241 for (size_t i = 0; i < recv_codecs_.size(); ++i) {
1237 uint32_t rtx_ssrc; 1242 uint32_t rtx_ssrc;
1238 if (recv_codecs_[i].rtx_payload_type != -1 && 1243 if (recv_codecs_[i].rtx_payload_type != -1 &&
1239 sp.GetFidSsrc(ssrc, &rtx_ssrc)) { 1244 sp.GetFidSsrc(ssrc, &rtx_ssrc)) {
1240 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = 1245 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx =
1241 config->rtp.rtx[recv_codecs_[i].codec.id]; 1246 config->rtp.rtx[recv_codecs_[i].codec.id];
1242 rtx.ssrc = rtx_ssrc; 1247 rtx.ssrc = rtx_ssrc;
1243 rtx.payload_type = recv_codecs_[i].rtx_payload_type; 1248 rtx.payload_type = recv_codecs_[i].rtx_payload_type;
1244 } 1249 }
1245 } 1250 }
1246 1251
1247 // TODO(brandtr): This code needs to be generalized when we add support for 1252 config->rtp.extensions = recv_rtp_extensions_;
1248 // multistream protection.
1249 uint32_t flexfec_ssrc;
1250 if (sp.GetFecFrSsrc(ssrc, &flexfec_ssrc)) {
1251 flexfec_config->flexfec_ssrc = flexfec_ssrc;
1252 flexfec_config->protected_media_ssrcs = {ssrc};
1253 }
1254 } 1253 }
1255 1254
1256 bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) { 1255 bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) {
1257 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; 1256 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc;
1258 if (ssrc == 0) { 1257 if (ssrc == 0) {
1259 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; 1258 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported.";
1260 return false; 1259 return false;
1261 } 1260 }
1262 1261
1263 rtc::CritScope stream_lock(&stream_crit_); 1262 rtc::CritScope stream_lock(&stream_crit_);
(...skipping 1321 matching lines...)
2585 rtx_mapping[video_codecs[i].codec.id] != 2584 rtx_mapping[video_codecs[i].codec.id] !=
2586 ulpfec_config.red_payload_type) { 2585 ulpfec_config.red_payload_type) {
2587 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2586 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2588 } 2587 }
2589 } 2588 }
2590 2589
2591 return video_codecs; 2590 return video_codecs;
2592 } 2591 }
2593 2592
2594 } // namespace cricket 2593 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine