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

Unified Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 1608793004: Apply VideoOptions per stream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use const auto& when assigning find() return value. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 0dd8938dc3451758fb0441cb4df457baa6832abe..43b0f32d1fbf55cf94c71d4898695d7f11c5e4b4 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -616,7 +616,9 @@ WebRtcVideoChannel2::WebRtcVideoChannel2(
external_encoder_factory_(external_encoder_factory),
external_decoder_factory_(external_decoder_factory) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- options_.SetAll(options);
+
+ send_params_.options = options;
+
rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc;
sending_ = false;
default_send_ssrc_ = 0;
@@ -736,9 +738,9 @@ bool WebRtcVideoChannel2::GetChangedSendParameters(
// Handle options.
// TODO(pbos): Require VideoSendParameters to contain a full set of options
// and check if params.options != options_ instead of applying a delta.
- VideoOptions new_options = options_;
+ VideoOptions new_options = send_params_.options;
new_options.SetAll(params.options);
- if (!(new_options == options_)) {
+ if (!(new_options == send_params_.options)) {
changed_params->options = rtc::Optional<VideoOptions>(new_options);
}
@@ -801,7 +803,7 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) {
}
if (changed_params.options)
- options_.SetAll(*changed_params.options);
+ send_params_.options.SetAll(*changed_params.options);
{
rtc::CritScope stream_lock(&stream_crit_);
@@ -950,9 +952,7 @@ bool WebRtcVideoChannel2::SetVideoSend(uint32_t ssrc, bool enable,
return false;
}
if (enable && options) {
- VideoSendParameters new_params = send_params_;
- new_params.options.SetAll(*options);
- SetSendParameters(send_params_);
+ SetOptions(ssrc, *options);
}
return true;
}
@@ -996,10 +996,10 @@ bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) {
webrtc::VideoSendStream::Config config(this);
config.overuse_callback = this;
- WebRtcVideoSendStream* stream = new WebRtcVideoSendStream(
- call_, sp, config, external_encoder_factory_, options_,
- bitrate_config_.max_bitrate_bps, send_codec_, send_rtp_extensions_,
- send_params_);
+ WebRtcVideoSendStream* stream =
+ new WebRtcVideoSendStream(call_, sp, config, external_encoder_factory_,
+ bitrate_config_.max_bitrate_bps, send_codec_,
+ send_rtp_extensions_, send_params_);
uint32_t ssrc = sp.first_ssrc();
RTC_DCHECK(ssrc != 0);
@@ -1098,7 +1098,7 @@ bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp,
rtc::CritScope stream_lock(&stream_crit_);
// Remove running stream if this was a default stream.
- auto prev_stream = receive_streams_.find(ssrc);
+ const auto& prev_stream = receive_streams_.find(ssrc);
if (prev_stream != receive_streams_.end()) {
if (default_stream || !prev_stream->second->IsDefaultStream()) {
LOG(LS_ERROR) << "Receive stream for SSRC '" << ssrc
@@ -1268,11 +1268,12 @@ bool WebRtcVideoChannel2::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) {
RTC_DCHECK(ssrc != 0);
{
rtc::CritScope stream_lock(&stream_crit_);
- if (send_streams_.find(ssrc) == send_streams_.end()) {
+ const auto& kv = send_streams_.find(ssrc);
+ if (kv == send_streams_.end()) {
LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc;
return false;
}
- if (!send_streams_[ssrc]->SetCapturer(capturer)) {
+ if (!kv->second->SetCapturer(capturer)) {
return false;
}
}
@@ -1366,20 +1367,27 @@ bool WebRtcVideoChannel2::MuteStream(uint32_t ssrc, bool mute) {
<< (mute ? "mute" : "unmute");
RTC_DCHECK(ssrc != 0);
rtc::CritScope stream_lock(&stream_crit_);
- if (send_streams_.find(ssrc) == send_streams_.end()) {
+ const auto& kv = send_streams_.find(ssrc);
+ if (kv == send_streams_.end()) {
LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc;
return false;
}
- send_streams_[ssrc]->MuteStream(mute);
+ kv->second->MuteStream(mute);
return true;
}
// TODO(pbos): Remove SetOptions in favor of SetSendParameters.
-void WebRtcVideoChannel2::SetOptions(const VideoOptions& options) {
- VideoSendParameters new_params = send_params_;
- new_params.options.SetAll(options);
- SetSendParameters(send_params_);
+void WebRtcVideoChannel2::SetOptions(uint32_t ssrc,
+ const VideoOptions& options) {
+ LOG(LS_INFO) << "SetOptions: ssrc " << ssrc << ": " << options.ToString();
+
+ rtc::CritScope stream_lock(&stream_crit_);
+ const auto& kv = send_streams_.find(ssrc);
+ if (kv == send_streams_.end()) {
+ return;
+ }
+ kv->second->SetOptions(options);
}
void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) {
@@ -1481,7 +1489,6 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
const StreamParams& sp,
const webrtc::VideoSendStream::Config& config,
WebRtcVideoEncoderFactory* external_encoder_factory,
- const VideoOptions& options,
int max_bitrate_bps,
const rtc::Optional<VideoCodecSettings>& codec_settings,
const std::vector<webrtc::RtpExtension>& rtp_extensions,
@@ -1493,7 +1500,7 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
call_(call),
external_encoder_factory_(external_encoder_factory),
stream_(NULL),
- parameters_(config, options, max_bitrate_bps, codec_settings),
+ parameters_(config, send_params.options, max_bitrate_bps, codec_settings),
pending_encoder_reconfiguration_(false),
allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false),
capturer_(NULL),
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698