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

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

Issue 2042603002: Movable support for VideoReceiveStream::Config and avoid copies (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address comments 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
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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 // Set up A/V sync group based on sync label. 1220 // Set up A/V sync group based on sync label.
1221 config.sync_group = sp.sync_label; 1221 config.sync_group = sp.sync_label;
1222 1222
1223 config.rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false; 1223 config.rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false;
1224 config.rtp.transport_cc = 1224 config.rtp.transport_cc =
1225 send_codec_ ? HasTransportCc(send_codec_->codec) : false; 1225 send_codec_ ? HasTransportCc(send_codec_->codec) : false;
1226 config.disable_prerenderer_smoothing = 1226 config.disable_prerenderer_smoothing =
1227 video_config_.disable_prerenderer_smoothing; 1227 video_config_.disable_prerenderer_smoothing;
1228 1228
1229 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( 1229 receive_streams_[ssrc] = new WebRtcVideoReceiveStream(
1230 call_, sp, config, external_decoder_factory_, default_stream, 1230 call_, sp, std::move(config), external_decoder_factory_, default_stream,
1231 recv_codecs_, red_disabled_by_remote_side_); 1231 recv_codecs_, red_disabled_by_remote_side_);
1232 1232
1233 return true; 1233 return true;
1234 } 1234 }
1235 1235
1236 void WebRtcVideoChannel2::ConfigureReceiverRtp( 1236 void WebRtcVideoChannel2::ConfigureReceiverRtp(
1237 webrtc::VideoReceiveStream::Config* config, 1237 webrtc::VideoReceiveStream::Config* config,
1238 const StreamParams& sp) const { 1238 const StreamParams& sp) const {
1239 uint32_t ssrc = sp.first_ssrc(); 1239 uint32_t ssrc = sp.first_ssrc();
1240 1240
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 pending_encoder_reconfiguration_ = false; 2190 pending_encoder_reconfiguration_ = false;
2191 2191
2192 if (sending_) { 2192 if (sending_) {
2193 stream_->Start(); 2193 stream_->Start();
2194 } 2194 }
2195 } 2195 }
2196 2196
2197 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( 2197 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream(
2198 webrtc::Call* call, 2198 webrtc::Call* call,
2199 const StreamParams& sp, 2199 const StreamParams& sp,
2200 const webrtc::VideoReceiveStream::Config& config, 2200 webrtc::VideoReceiveStream::Config config,
2201 WebRtcVideoDecoderFactory* external_decoder_factory, 2201 WebRtcVideoDecoderFactory* external_decoder_factory,
2202 bool default_stream, 2202 bool default_stream,
2203 const std::vector<VideoCodecSettings>& recv_codecs, 2203 const std::vector<VideoCodecSettings>& recv_codecs,
2204 bool red_disabled_by_remote_side) 2204 bool red_disabled_by_remote_side)
2205 : call_(call), 2205 : call_(call),
2206 ssrcs_(sp.ssrcs), 2206 ssrcs_(sp.ssrcs),
2207 ssrc_groups_(sp.ssrc_groups), 2207 ssrc_groups_(sp.ssrc_groups),
2208 stream_(NULL), 2208 stream_(NULL),
2209 default_stream_(default_stream), 2209 default_stream_(default_stream),
2210 config_(config), 2210 config_(std::move(config)),
2211 red_disabled_by_remote_side_(red_disabled_by_remote_side), 2211 red_disabled_by_remote_side_(red_disabled_by_remote_side),
2212 external_decoder_factory_(external_decoder_factory), 2212 external_decoder_factory_(external_decoder_factory),
2213 sink_(NULL), 2213 sink_(NULL),
2214 last_width_(-1), 2214 last_width_(-1),
2215 last_height_(-1), 2215 last_height_(-1),
2216 first_frame_timestamp_(-1), 2216 first_frame_timestamp_(-1),
2217 estimated_remote_start_ntp_time_ms_(0) { 2217 estimated_remote_start_ntp_time_ms_(0) {
2218 config_.renderer = this; 2218 config_.renderer = this;
2219 std::vector<AllocatedDecoder> old_decoders; 2219 std::vector<AllocatedDecoder> old_decoders;
2220 ConfigureCodecs(recv_codecs, &old_decoders); 2220 ConfigureCodecs(recv_codecs, &old_decoders);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetRecvParameters"; 2377 LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetRecvParameters";
2378 RecreateWebRtcStream(); 2378 RecreateWebRtcStream();
2379 ClearDecoders(&old_decoders); 2379 ClearDecoders(&old_decoders);
2380 } 2380 }
2381 } 2381 }
2382 2382
2383 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RecreateWebRtcStream() { 2383 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RecreateWebRtcStream() {
2384 if (stream_ != NULL) { 2384 if (stream_ != NULL) {
2385 call_->DestroyVideoReceiveStream(stream_); 2385 call_->DestroyVideoReceiveStream(stream_);
2386 } 2386 }
2387 webrtc::VideoReceiveStream::Config config = config_; 2387 webrtc::VideoReceiveStream::Config config = config_.Copy();
2388 if (red_disabled_by_remote_side_) { 2388 if (red_disabled_by_remote_side_) {
2389 config.rtp.fec.red_payload_type = -1; 2389 config.rtp.fec.red_payload_type = -1;
2390 config.rtp.fec.ulpfec_payload_type = -1; 2390 config.rtp.fec.ulpfec_payload_type = -1;
2391 config.rtp.fec.red_rtx_payload_type = -1; 2391 config.rtp.fec.red_rtx_payload_type = -1;
2392 } 2392 }
2393 stream_ = call_->CreateVideoReceiveStream(config); 2393 stream_ = call_->CreateVideoReceiveStream(std::move(config));
2394 stream_->Start(); 2394 stream_->Start();
2395 } 2395 }
2396 2396
2397 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ClearDecoders( 2397 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ClearDecoders(
2398 std::vector<AllocatedDecoder>* allocated_decoders) { 2398 std::vector<AllocatedDecoder>* allocated_decoders) {
2399 for (size_t i = 0; i < allocated_decoders->size(); ++i) { 2399 for (size_t i = 0; i < allocated_decoders->size(); ++i) {
2400 if ((*allocated_decoders)[i].external) { 2400 if ((*allocated_decoders)[i].external) {
2401 external_decoder_factory_->DestroyVideoDecoder( 2401 external_decoder_factory_->DestroyVideoDecoder(
2402 (*allocated_decoders)[i].external_decoder); 2402 (*allocated_decoders)[i].external_decoder);
2403 } 2403 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 rtx_mapping[video_codecs[i].codec.id] != 2610 rtx_mapping[video_codecs[i].codec.id] !=
2611 fec_settings.red_payload_type) { 2611 fec_settings.red_payload_type) {
2612 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2612 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2613 } 2613 }
2614 } 2614 }
2615 2615
2616 return video_codecs; 2616 return video_codecs;
2617 } 2617 }
2618 2618
2619 } // namespace cricket 2619 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698