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

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: Fix for most vexing parse + comments Created 5 years, 4 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 * 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 WebRtcVideoDecoderFactory* external_decoder_factory) 775 WebRtcVideoDecoderFactory* external_decoder_factory)
776 : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_), 776 : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),
777 voice_channel_(voice_channel), 777 voice_channel_(voice_channel),
778 voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1), 778 voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1),
779 external_encoder_factory_(external_encoder_factory), 779 external_encoder_factory_(external_encoder_factory),
780 external_decoder_factory_(external_decoder_factory) { 780 external_decoder_factory_(external_decoder_factory) {
781 DCHECK(thread_checker_.CalledOnValidThread()); 781 DCHECK(thread_checker_.CalledOnValidThread());
782 SetDefaultOptions(); 782 SetDefaultOptions();
783 options_.SetAll(options); 783 options_.SetAll(options);
784 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); 784 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_);
785 webrtc::Call::Config config(this); 785 webrtc::Call::Config config;
786 config.overuse_callback = this; 786 config.overuse_callback = this;
787 if (voice_engine != NULL) { 787 if (voice_engine != NULL) {
788 config.voice_engine = voice_engine->voe()->engine(); 788 config.voice_engine = voice_engine->voe()->engine();
789 } 789 }
790 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; 790 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
791 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; 791 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
792 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; 792 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
793 call_.reset(call_factory->CreateCall(config)); 793 call_.reset(call_factory->CreateCall(config));
794 if (voice_channel_) { 794 if (voice_channel_) {
795 voice_channel_->SetCall(call_.get()); 795 voice_channel_->SetCall(call_.get());
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 rtc::CritScope stream_lock(&stream_crit_); 1056 rtc::CritScope stream_lock(&stream_crit_);
1057 1057
1058 if (!ValidateSendSsrcAvailability(sp)) 1058 if (!ValidateSendSsrcAvailability(sp))
1059 return false; 1059 return false;
1060 1060
1061 for (uint32 used_ssrc : sp.ssrcs) 1061 for (uint32 used_ssrc : sp.ssrcs)
1062 send_ssrcs_.insert(used_ssrc); 1062 send_ssrcs_.insert(used_ssrc);
1063 1063
1064 WebRtcVideoSendStream* stream = 1064 WebRtcVideoSendStream* stream =
1065 new WebRtcVideoSendStream(call_.get(), 1065 new WebRtcVideoSendStream(call_.get(),
1066 sp,
1067 webrtc::VideoSendStream::Config(this),
1066 external_encoder_factory_, 1068 external_encoder_factory_,
1067 options_, 1069 options_,
1068 bitrate_config_.max_bitrate_bps, 1070 bitrate_config_.max_bitrate_bps,
1069 send_codec_, 1071 send_codec_,
1070 sp,
1071 send_rtp_extensions_); 1072 send_rtp_extensions_);
1072 1073
1073 uint32 ssrc = sp.first_ssrc(); 1074 uint32 ssrc = sp.first_ssrc();
1074 DCHECK(ssrc != 0); 1075 DCHECK(ssrc != 0);
1075 send_streams_[ssrc] = stream; 1076 send_streams_[ssrc] = stream;
1076 1077
1077 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { 1078 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) {
1078 rtcp_receiver_report_ssrc_ = ssrc; 1079 rtcp_receiver_report_ssrc_ = ssrc;
1079 for (auto& kv : receive_streams_) 1080 for (auto& kv : receive_streams_)
1080 kv.second->SetLocalSsrc(ssrc); 1081 kv.second->SetLocalSsrc(ssrc);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 DeleteReceiveStream(prev_stream->second); 1163 DeleteReceiveStream(prev_stream->second);
1163 receive_streams_.erase(prev_stream); 1164 receive_streams_.erase(prev_stream);
1164 } 1165 }
1165 1166
1166 if (!ValidateReceiveSsrcAvailability(sp)) 1167 if (!ValidateReceiveSsrcAvailability(sp))
1167 return false; 1168 return false;
1168 1169
1169 for (uint32 used_ssrc : sp.ssrcs) 1170 for (uint32 used_ssrc : sp.ssrcs)
1170 receive_ssrcs_.insert(used_ssrc); 1171 receive_ssrcs_.insert(used_ssrc);
1171 1172
1172 webrtc::VideoReceiveStream::Config config; 1173 webrtc::VideoReceiveStream::Config config(this);
1173 ConfigureReceiverRtp(&config, sp); 1174 ConfigureReceiverRtp(&config, sp);
1174 1175
1175 // Set up A/V sync group based on sync label. 1176 // Set up A/V sync group based on sync label.
1176 config.sync_group = sp.sync_label; 1177 config.sync_group = sp.sync_label;
1177 1178
1178 config.rtp.remb = false; 1179 config.rtp.remb = false;
1179 VideoCodecSettings send_codec; 1180 VideoCodecSettings send_codec;
1180 if (send_codec_.Get(&send_codec)) { 1181 if (send_codec_.Get(&send_codec)) {
1181 config.rtp.remb = HasRemb(send_codec.codec); 1182 config.rtp.remb = HasRemb(send_codec.codec);
1182 } 1183 }
1183 1184
1184 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( 1185 receive_streams_[ssrc] = new WebRtcVideoReceiveStream(
1185 call_.get(), sp, external_decoder_factory_, default_stream, config, 1186 call_.get(), sp, config, external_decoder_factory_, default_stream,
1186 recv_codecs_); 1187 recv_codecs_);
1187 1188
1188 return true; 1189 return true;
1189 } 1190 }
1190 1191
1191 void WebRtcVideoChannel2::ConfigureReceiverRtp( 1192 void WebRtcVideoChannel2::ConfigureReceiverRtp(
1192 webrtc::VideoReceiveStream::Config* config, 1193 webrtc::VideoReceiveStream::Config* config,
1193 const StreamParams& sp) const { 1194 const StreamParams& sp) const {
1194 uint32 ssrc = sp.first_ssrc(); 1195 uint32 ssrc = sp.first_ssrc();
1195 1196
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 external(external) { 1662 external(external) {
1662 if (external) { 1663 if (external) {
1663 external_encoder = encoder; 1664 external_encoder = encoder;
1664 this->encoder = 1665 this->encoder =
1665 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); 1666 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder);
1666 } 1667 }
1667 } 1668 }
1668 1669
1669 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( 1670 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
1670 webrtc::Call* call, 1671 webrtc::Call* call,
1672 const StreamParams& sp,
1673 const webrtc::VideoSendStream::Config& config,
1671 WebRtcVideoEncoderFactory* external_encoder_factory, 1674 WebRtcVideoEncoderFactory* external_encoder_factory,
1672 const VideoOptions& options, 1675 const VideoOptions& options,
1673 int max_bitrate_bps, 1676 int max_bitrate_bps,
1674 const Settable<VideoCodecSettings>& codec_settings, 1677 const Settable<VideoCodecSettings>& codec_settings,
1675 const StreamParams& sp,
1676 const std::vector<webrtc::RtpExtension>& rtp_extensions) 1678 const std::vector<webrtc::RtpExtension>& rtp_extensions)
1677 : ssrcs_(sp.ssrcs), 1679 : ssrcs_(sp.ssrcs),
1678 ssrc_groups_(sp.ssrc_groups), 1680 ssrc_groups_(sp.ssrc_groups),
1679 call_(call), 1681 call_(call),
1680 external_encoder_factory_(external_encoder_factory), 1682 external_encoder_factory_(external_encoder_factory),
1681 stream_(NULL), 1683 stream_(NULL),
1682 parameters_(webrtc::VideoSendStream::Config(), 1684 parameters_(config, options, max_bitrate_bps, codec_settings),
1683 options,
1684 max_bitrate_bps,
1685 codec_settings),
1686 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), 1685 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false),
1687 capturer_(NULL), 1686 capturer_(NULL),
1688 sending_(false), 1687 sending_(false),
1689 muted_(false), 1688 muted_(false),
1690 old_adapt_changes_(0), 1689 old_adapt_changes_(0),
1691 first_frame_timestamp_ms_(0), 1690 first_frame_timestamp_ms_(0),
1692 last_frame_timestamp_ms_(0) { 1691 last_frame_timestamp_ms_(0) {
1693 parameters_.config.rtp.max_packet_size = kVideoMtu; 1692 parameters_.config.rtp.max_packet_size = kVideoMtu;
1694 1693
1695 sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs); 1694 sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs);
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 parameters_.encoder_config.encoder_specific_settings = NULL; 2251 parameters_.encoder_config.encoder_specific_settings = NULL;
2253 2252
2254 if (sending_) { 2253 if (sending_) {
2255 stream_->Start(); 2254 stream_->Start();
2256 } 2255 }
2257 } 2256 }
2258 2257
2259 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( 2258 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream(
2260 webrtc::Call* call, 2259 webrtc::Call* call,
2261 const StreamParams& sp, 2260 const StreamParams& sp,
2261 const webrtc::VideoReceiveStream::Config& config,
2262 WebRtcVideoDecoderFactory* external_decoder_factory, 2262 WebRtcVideoDecoderFactory* external_decoder_factory,
2263 bool default_stream, 2263 bool default_stream,
2264 const webrtc::VideoReceiveStream::Config& config,
2265 const std::vector<VideoCodecSettings>& recv_codecs) 2264 const std::vector<VideoCodecSettings>& recv_codecs)
2266 : call_(call), 2265 : call_(call),
2267 ssrcs_(sp.ssrcs), 2266 ssrcs_(sp.ssrcs),
2268 ssrc_groups_(sp.ssrc_groups), 2267 ssrc_groups_(sp.ssrc_groups),
2269 stream_(NULL), 2268 stream_(NULL),
2270 default_stream_(default_stream), 2269 default_stream_(default_stream),
2271 config_(config), 2270 config_(config),
2272 external_decoder_factory_(external_decoder_factory), 2271 external_decoder_factory_(external_decoder_factory),
2273 renderer_(NULL), 2272 renderer_(NULL),
2274 last_width_(-1), 2273 last_width_(-1),
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2638 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2640 } 2639 }
2641 } 2640 }
2642 2641
2643 return video_codecs; 2642 return video_codecs;
2644 } 2643 }
2645 2644
2646 } // namespace cricket 2645 } // namespace cricket
2647 2646
2648 #endif // HAVE_WEBRTC_VIDEO 2647 #endif // HAVE_WEBRTC_VIDEO
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698