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

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

Issue 1273363005: Add send transports to individual webrtc::Call streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase+comment Created 5 years, 3 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 | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvoiceengine_unittest.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 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 WebRtcVideoDecoderFactory* external_decoder_factory) 781 WebRtcVideoDecoderFactory* external_decoder_factory)
782 : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), 782 : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),
783 voice_channel_(voice_channel), 783 voice_channel_(voice_channel),
784 voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1), 784 voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1),
785 external_encoder_factory_(external_encoder_factory), 785 external_encoder_factory_(external_encoder_factory),
786 external_decoder_factory_(external_decoder_factory) { 786 external_decoder_factory_(external_decoder_factory) {
787 DCHECK(thread_checker_.CalledOnValidThread()); 787 DCHECK(thread_checker_.CalledOnValidThread());
788 SetDefaultOptions(); 788 SetDefaultOptions();
789 options_.SetAll(options); 789 options_.SetAll(options);
790 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); 790 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_);
791 webrtc::Call::Config config(this); 791 webrtc::Call::Config config;
792 config.overuse_callback = this; 792 config.overuse_callback = this;
793 if (voice_engine != NULL) { 793 if (voice_engine != NULL) {
794 config.voice_engine = voice_engine->voe()->engine(); 794 config.voice_engine = voice_engine->voe()->engine();
795 } 795 }
796 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; 796 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
797 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; 797 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
798 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; 798 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
799 call_.reset(call_factory->CreateCall(config)); 799 call_.reset(call_factory->CreateCall(config));
800 if (voice_channel_) { 800 if (voice_channel_) {
801 voice_channel_->SetCall(call_.get()); 801 voice_channel_->SetCall(call_.get());
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 rtc::CritScope stream_lock(&stream_crit_); 1112 rtc::CritScope stream_lock(&stream_crit_);
1113 1113
1114 if (!ValidateSendSsrcAvailability(sp)) 1114 if (!ValidateSendSsrcAvailability(sp))
1115 return false; 1115 return false;
1116 1116
1117 for (uint32 used_ssrc : sp.ssrcs) 1117 for (uint32 used_ssrc : sp.ssrcs)
1118 send_ssrcs_.insert(used_ssrc); 1118 send_ssrcs_.insert(used_ssrc);
1119 1119
1120 WebRtcVideoSendStream* stream = 1120 WebRtcVideoSendStream* stream =
1121 new WebRtcVideoSendStream(call_.get(), 1121 new WebRtcVideoSendStream(call_.get(),
1122 sp,
1123 webrtc::VideoSendStream::Config(this),
1122 external_encoder_factory_, 1124 external_encoder_factory_,
1123 options_, 1125 options_,
1124 bitrate_config_.max_bitrate_bps, 1126 bitrate_config_.max_bitrate_bps,
1125 send_codec_, 1127 send_codec_,
1126 sp,
1127 send_rtp_extensions_); 1128 send_rtp_extensions_);
1128 1129
1129 uint32 ssrc = sp.first_ssrc(); 1130 uint32 ssrc = sp.first_ssrc();
1130 DCHECK(ssrc != 0); 1131 DCHECK(ssrc != 0);
1131 send_streams_[ssrc] = stream; 1132 send_streams_[ssrc] = stream;
1132 1133
1133 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { 1134 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) {
1134 rtcp_receiver_report_ssrc_ = ssrc; 1135 rtcp_receiver_report_ssrc_ = ssrc;
1135 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " 1136 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added "
1136 "a send stream."; 1137 "a send stream.";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 DeleteReceiveStream(prev_stream->second); 1221 DeleteReceiveStream(prev_stream->second);
1221 receive_streams_.erase(prev_stream); 1222 receive_streams_.erase(prev_stream);
1222 } 1223 }
1223 1224
1224 if (!ValidateReceiveSsrcAvailability(sp)) 1225 if (!ValidateReceiveSsrcAvailability(sp))
1225 return false; 1226 return false;
1226 1227
1227 for (uint32 used_ssrc : sp.ssrcs) 1228 for (uint32 used_ssrc : sp.ssrcs)
1228 receive_ssrcs_.insert(used_ssrc); 1229 receive_ssrcs_.insert(used_ssrc);
1229 1230
1230 webrtc::VideoReceiveStream::Config config; 1231 webrtc::VideoReceiveStream::Config config(this);
1231 ConfigureReceiverRtp(&config, sp); 1232 ConfigureReceiverRtp(&config, sp);
1232 1233
1233 // Set up A/V sync group based on sync label. 1234 // Set up A/V sync group based on sync label.
1234 config.sync_group = sp.sync_label; 1235 config.sync_group = sp.sync_label;
1235 1236
1236 config.rtp.remb = false; 1237 config.rtp.remb = false;
1237 VideoCodecSettings send_codec; 1238 VideoCodecSettings send_codec;
1238 if (send_codec_.Get(&send_codec)) { 1239 if (send_codec_.Get(&send_codec)) {
1239 config.rtp.remb = HasRemb(send_codec.codec); 1240 config.rtp.remb = HasRemb(send_codec.codec);
1240 } 1241 }
1241 1242
1242 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( 1243 receive_streams_[ssrc] = new WebRtcVideoReceiveStream(
1243 call_.get(), sp, external_decoder_factory_, default_stream, config, 1244 call_.get(), sp, config, external_decoder_factory_, default_stream,
1244 recv_codecs_); 1245 recv_codecs_);
1245 1246
1246 return true; 1247 return true;
1247 } 1248 }
1248 1249
1249 void WebRtcVideoChannel2::ConfigureReceiverRtp( 1250 void WebRtcVideoChannel2::ConfigureReceiverRtp(
1250 webrtc::VideoReceiveStream::Config* config, 1251 webrtc::VideoReceiveStream::Config* config,
1251 const StreamParams& sp) const { 1252 const StreamParams& sp) const {
1252 uint32 ssrc = sp.first_ssrc(); 1253 uint32 ssrc = sp.first_ssrc();
1253 1254
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 external(external) { 1726 external(external) {
1726 if (external) { 1727 if (external) {
1727 external_encoder = encoder; 1728 external_encoder = encoder;
1728 this->encoder = 1729 this->encoder =
1729 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); 1730 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder);
1730 } 1731 }
1731 } 1732 }
1732 1733
1733 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( 1734 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
1734 webrtc::Call* call, 1735 webrtc::Call* call,
1736 const StreamParams& sp,
1737 const webrtc::VideoSendStream::Config& config,
1735 WebRtcVideoEncoderFactory* external_encoder_factory, 1738 WebRtcVideoEncoderFactory* external_encoder_factory,
1736 const VideoOptions& options, 1739 const VideoOptions& options,
1737 int max_bitrate_bps, 1740 int max_bitrate_bps,
1738 const Settable<VideoCodecSettings>& codec_settings, 1741 const Settable<VideoCodecSettings>& codec_settings,
1739 const StreamParams& sp,
1740 const std::vector<webrtc::RtpExtension>& rtp_extensions) 1742 const std::vector<webrtc::RtpExtension>& rtp_extensions)
1741 : ssrcs_(sp.ssrcs), 1743 : ssrcs_(sp.ssrcs),
1742 ssrc_groups_(sp.ssrc_groups), 1744 ssrc_groups_(sp.ssrc_groups),
1743 call_(call), 1745 call_(call),
1744 external_encoder_factory_(external_encoder_factory), 1746 external_encoder_factory_(external_encoder_factory),
1745 stream_(NULL), 1747 stream_(NULL),
1746 parameters_(webrtc::VideoSendStream::Config(), 1748 parameters_(config, options, max_bitrate_bps, codec_settings),
1747 options,
1748 max_bitrate_bps,
1749 codec_settings),
1750 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), 1749 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false),
1751 capturer_(NULL), 1750 capturer_(NULL),
1752 sending_(false), 1751 sending_(false),
1753 muted_(false), 1752 muted_(false),
1754 old_adapt_changes_(0), 1753 old_adapt_changes_(0),
1755 first_frame_timestamp_ms_(0), 1754 first_frame_timestamp_ms_(0),
1756 last_frame_timestamp_ms_(0) { 1755 last_frame_timestamp_ms_(0) {
1757 parameters_.config.rtp.max_packet_size = kVideoMtu; 1756 parameters_.config.rtp.max_packet_size = kVideoMtu;
1758 1757
1759 sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs); 1758 sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs);
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 parameters_.encoder_config.encoder_specific_settings = NULL; 2327 parameters_.encoder_config.encoder_specific_settings = NULL;
2329 2328
2330 if (sending_) { 2329 if (sending_) {
2331 stream_->Start(); 2330 stream_->Start();
2332 } 2331 }
2333 } 2332 }
2334 2333
2335 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( 2334 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream(
2336 webrtc::Call* call, 2335 webrtc::Call* call,
2337 const StreamParams& sp, 2336 const StreamParams& sp,
2337 const webrtc::VideoReceiveStream::Config& config,
2338 WebRtcVideoDecoderFactory* external_decoder_factory, 2338 WebRtcVideoDecoderFactory* external_decoder_factory,
2339 bool default_stream, 2339 bool default_stream,
2340 const webrtc::VideoReceiveStream::Config& config,
2341 const std::vector<VideoCodecSettings>& recv_codecs) 2340 const std::vector<VideoCodecSettings>& recv_codecs)
2342 : call_(call), 2341 : call_(call),
2343 ssrcs_(sp.ssrcs), 2342 ssrcs_(sp.ssrcs),
2344 ssrc_groups_(sp.ssrc_groups), 2343 ssrc_groups_(sp.ssrc_groups),
2345 stream_(NULL), 2344 stream_(NULL),
2346 default_stream_(default_stream), 2345 default_stream_(default_stream),
2347 config_(config), 2346 config_(config),
2348 external_decoder_factory_(external_decoder_factory), 2347 external_decoder_factory_(external_decoder_factory),
2349 renderer_(NULL), 2348 renderer_(NULL),
2350 last_width_(-1), 2349 last_width_(-1),
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2731 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2733 } 2732 }
2734 } 2733 }
2735 2734
2736 return video_codecs; 2735 return video_codecs;
2737 } 2736 }
2738 2737
2739 } // namespace cricket 2738 } // namespace cricket
2740 2739
2741 #endif // HAVE_WEBRTC_VIDEO 2740 #endif // HAVE_WEBRTC_VIDEO
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698