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

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

Issue 2710493008: Recreate WebrtcVideoSendStream if screen content setting is changed. (Closed)
Patch Set: Fix uses of incorrect stream Created 3 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 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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { 1605 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
1606 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend"); 1606 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend");
1607 RTC_DCHECK_RUN_ON(&thread_checker_); 1607 RTC_DCHECK_RUN_ON(&thread_checker_);
1608 1608
1609 // Ignore |options| pointer if |enable| is false. 1609 // Ignore |options| pointer if |enable| is false.
1610 bool options_present = enable && options; 1610 bool options_present = enable && options;
1611 1611
1612 if (options_present) { 1612 if (options_present) {
1613 VideoOptions old_options = parameters_.options; 1613 VideoOptions old_options = parameters_.options;
1614 parameters_.options.SetAll(*options); 1614 parameters_.options.SetAll(*options);
1615 if (parameters_.options != old_options) { 1615 if (parameters_.options.is_screencast.value_or(false) !=
1616 old_options.is_screencast.value_or(false) &&
1617 parameters_.codec_settings) {
pthatcher1 2017/02/22 22:24:14 This needs to test that all the other parameters_.
Taylor Brandstetter 2017/02/23 00:46:49 Why? A whole new webrtc::VideoEncoder will be crea
pthatcher1 2017/02/23 21:05:33 First, it's not clear from the code that this case
sprang_webrtc 2017/02/26 13:41:27 Agree that it's not entirely obvious that Reconfig
1618 // If screen content settings change, we may need to recreate the codec
1619 // instance so that the correct type is used. Add a param to force the
1620 // SetCodec() to not resuse the current instance.
1621 allocated_encoder_.codec.params["recreate"] = "true";
pthatcher1 2017/02/22 22:24:14 What is this codec parameter? Is it already defin
sprang_webrtc 2017/02/23 15:10:14 It is kinda hacky, and is workaround just to avoid
pthatcher1 2017/02/23 21:05:33 It seems like we should just have a small refactor
Taylor Brandstetter 2017/02/24 00:13:55 Or, just make CreateVideoEncoder a bit smarter. Th
sprang_webrtc 2017/02/26 13:41:27 CreateVideoEncoder doesn't know about the change i
1622 SetCodec(*parameters_.codec_settings);
1623 } else if (parameters_.options != old_options) {
1616 ReconfigureEncoder(); 1624 ReconfigureEncoder();
1617 } 1625 }
1618 } 1626 }
1619 1627
1620 if (source_ && stream_) { 1628 if (source_ && stream_) {
1621 stream_->SetSource( 1629 stream_->SetSource(
1622 nullptr, webrtc::VideoSendStream::DegradationPreference::kBalanced); 1630 nullptr, webrtc::VideoSendStream::DegradationPreference::kBalanced);
1623 } 1631 }
1624 // Switch to the new source. 1632 // Switch to the new source.
1625 source_ = source; 1633 source_ = source;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 1903
1896 RTC_CHECK(parameters_.codec_settings); 1904 RTC_CHECK(parameters_.codec_settings);
1897 VideoCodecSettings codec_settings = *parameters_.codec_settings; 1905 VideoCodecSettings codec_settings = *parameters_.codec_settings;
1898 1906
1899 webrtc::VideoEncoderConfig encoder_config = 1907 webrtc::VideoEncoderConfig encoder_config =
1900 CreateVideoEncoderConfig(codec_settings.codec); 1908 CreateVideoEncoderConfig(codec_settings.codec);
1901 1909
1902 encoder_config.encoder_specific_settings = ConfigureVideoEncoderSettings( 1910 encoder_config.encoder_specific_settings = ConfigureVideoEncoderSettings(
1903 codec_settings.codec); 1911 codec_settings.codec);
1904 1912
1905 stream_->ReconfigureVideoEncoder(encoder_config.Copy()); 1913 stream_->ReconfigureVideoEncoder(encoder_config.Copy());
Taylor Brandstetter 2017/02/23 00:46:49 If ReconfigureVideoEncoder doesn't support changin
sprang_webrtc 2017/02/23 15:10:14 Good idea. I'll add it to webrtc::VideoSendStream
1906 1914
1907 encoder_config.encoder_specific_settings = NULL; 1915 encoder_config.encoder_specific_settings = NULL;
1908 1916
1909 parameters_.encoder_config = std::move(encoder_config); 1917 parameters_.encoder_config = std::move(encoder_config);
1910 } 1918 }
1911 1919
1912 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetSend(bool send) { 1920 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetSend(bool send) {
1913 RTC_DCHECK_RUN_ON(&thread_checker_); 1921 RTC_DCHECK_RUN_ON(&thread_checker_);
1914 sending_ = send; 1922 sending_ = send;
1915 UpdateSendState(); 1923 UpdateSendState();
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 rtx_mapping[video_codecs[i].codec.id] != 2535 rtx_mapping[video_codecs[i].codec.id] !=
2528 ulpfec_config.red_payload_type) { 2536 ulpfec_config.red_payload_type) {
2529 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2537 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2530 } 2538 }
2531 } 2539 }
2532 2540
2533 return video_codecs; 2541 return video_codecs;
2534 } 2542 }
2535 2543
2536 } // namespace cricket 2544 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698