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

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

Issue 1697163002: Remove conference_mode flag from AudioOptions and VideoOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix logic when SetSendParameters changes conference_mode but no options. 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 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 726 }
727 727
728 // Handle max bitrate. 728 // Handle max bitrate.
729 if (params.max_bandwidth_bps != bitrate_config_.max_bitrate_bps && 729 if (params.max_bandwidth_bps != bitrate_config_.max_bitrate_bps &&
730 params.max_bandwidth_bps >= 0) { 730 params.max_bandwidth_bps >= 0) {
731 // 0 uncaps max bitrate (-1). 731 // 0 uncaps max bitrate (-1).
732 changed_params->max_bandwidth_bps = rtc::Optional<int>( 732 changed_params->max_bandwidth_bps = rtc::Optional<int>(
733 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps); 733 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps);
734 } 734 }
735 735
736 // Handle conference mode.
737 if (params.conference_mode != send_params_.conference_mode) {
738 changed_params->conference_mode =
739 rtc::Optional<bool>(params.conference_mode);
740 }
741
736 // Handle options. 742 // Handle options.
737 // TODO(pbos): Require VideoSendParameters to contain a full set of options 743 // TODO(pbos): Require VideoSendParameters to contain a full set of options
738 // and check if params.options != options_ instead of applying a delta. 744 // and check if params.options != options_ instead of applying a delta.
739 VideoOptions new_options = options_; 745 VideoOptions new_options = options_;
740 new_options.SetAll(params.options); 746 new_options.SetAll(params.options);
741 if (!(new_options == options_)) { 747 if (!(new_options == options_)) {
742 changed_params->options = rtc::Optional<VideoOptions>(new_options); 748 changed_params->options = rtc::Optional<VideoOptions>(new_options);
743 } 749 }
744 750
745 // Handle RTCP mode. 751 // Handle RTCP mode.
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 parameters_(config, options, max_bitrate_bps, codec_settings), 1502 parameters_(config, options, max_bitrate_bps, codec_settings),
1497 pending_encoder_reconfiguration_(false), 1503 pending_encoder_reconfiguration_(false),
1498 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), 1504 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false),
1499 capturer_(NULL), 1505 capturer_(NULL),
1500 sending_(false), 1506 sending_(false),
1501 muted_(false), 1507 muted_(false),
1502 old_adapt_changes_(0), 1508 old_adapt_changes_(0),
1503 first_frame_timestamp_ms_(0), 1509 first_frame_timestamp_ms_(0),
1504 last_frame_timestamp_ms_(0) { 1510 last_frame_timestamp_ms_(0) {
1505 parameters_.config.rtp.max_packet_size = kVideoMtu; 1511 parameters_.config.rtp.max_packet_size = kVideoMtu;
1512 parameters_.conference_mode = send_params.conference_mode;
1506 1513
1507 sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs); 1514 sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs);
1508 sp.GetFidSsrcs(parameters_.config.rtp.ssrcs, 1515 sp.GetFidSsrcs(parameters_.config.rtp.ssrcs,
1509 &parameters_.config.rtp.rtx.ssrcs); 1516 &parameters_.config.rtp.rtx.ssrcs);
1510 parameters_.config.rtp.c_name = sp.cname; 1517 parameters_.config.rtp.c_name = sp.cname;
1511 parameters_.config.rtp.extensions = rtp_extensions; 1518 parameters_.config.rtp.extensions = rtp_extensions;
1512 parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size 1519 parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size
1513 ? webrtc::RtcpMode::kReducedSize 1520 ? webrtc::RtcpMode::kReducedSize
1514 : webrtc::RtcpMode::kCompound; 1521 : webrtc::RtcpMode::kCompound;
1515 1522
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 capturer_->AddOrUpdateSink(this, sink_wants_); 1792 capturer_->AddOrUpdateSink(this, sink_wants_);
1786 } 1793 }
1787 recreate_stream = true; 1794 recreate_stream = true;
1788 } 1795 }
1789 if (params.max_bandwidth_bps) { 1796 if (params.max_bandwidth_bps) {
1790 // Max bitrate has changed, reconfigure encoder settings on the next frame 1797 // Max bitrate has changed, reconfigure encoder settings on the next frame
1791 // or stream recreation. 1798 // or stream recreation.
1792 parameters_.max_bitrate_bps = *params.max_bandwidth_bps; 1799 parameters_.max_bitrate_bps = *params.max_bandwidth_bps;
1793 pending_encoder_reconfiguration_ = true; 1800 pending_encoder_reconfiguration_ = true;
1794 } 1801 }
1802 if (params.conference_mode) {
1803 parameters_.conference_mode = *params.conference_mode;
1804 }
1795 // Set codecs and options. 1805 // Set codecs and options.
1796 if (params.codec) { 1806 if (params.codec) {
1797 SetCodecAndOptions(*params.codec, 1807 SetCodecAndOptions(*params.codec,
1798 params.options ? *params.options : parameters_.options); 1808 params.options ? *params.options : parameters_.options);
1799 return; 1809 return;
1800 } else if (params.options) { 1810 } else if (params.options) {
1801 // Reconfigure if codecs are already set. 1811 // Reconfigure if codecs are already set.
1802 if (parameters_.codec_settings) { 1812 if (parameters_.codec_settings) {
1803 SetCodecAndOptions(*parameters_.codec_settings, *params.options); 1813 SetCodecAndOptions(*parameters_.codec_settings, *params.options);
1804 return; 1814 return;
1805 } else { 1815 } else {
1806 parameters_.options = *params.options; 1816 parameters_.options = *params.options;
1807 } 1817 }
1808 } 1818 }
1819 else if (params.conference_mode && parameters_.codec_settings) {
1820 SetCodecAndOptions(*parameters_.codec_settings, parameters_.options);
1821 return;
1822 }
1809 if (recreate_stream) { 1823 if (recreate_stream) {
1810 LOG(LS_INFO) << "RecreateWebRtcStream (send) because of SetSendParameters"; 1824 LOG(LS_INFO) << "RecreateWebRtcStream (send) because of SetSendParameters";
1811 RecreateWebRtcStream(); 1825 RecreateWebRtcStream();
1812 } 1826 }
1813 } 1827 }
1814 1828
1815 webrtc::VideoEncoderConfig 1829 webrtc::VideoEncoderConfig
1816 WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig( 1830 WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig(
1817 const Dimensions& dimensions, 1831 const Dimensions& dimensions,
1818 const VideoCodec& codec) const { 1832 const VideoCodec& codec) const {
(...skipping 29 matching lines...) Expand all
1848 size_t stream_count = parameters_.config.rtp.ssrcs.size(); 1862 size_t stream_count = parameters_.config.rtp.ssrcs.size();
1849 if (IsCodecBlacklistedForSimulcast(codec.name) || dimensions.is_screencast) { 1863 if (IsCodecBlacklistedForSimulcast(codec.name) || dimensions.is_screencast) {
1850 stream_count = 1; 1864 stream_count = 1;
1851 } 1865 }
1852 1866
1853 encoder_config.streams = 1867 encoder_config.streams =
1854 CreateVideoStreams(clamped_codec, parameters_.options, 1868 CreateVideoStreams(clamped_codec, parameters_.options,
1855 parameters_.max_bitrate_bps, stream_count); 1869 parameters_.max_bitrate_bps, stream_count);
1856 1870
1857 // Conference mode screencast uses 2 temporal layers split at 100kbit. 1871 // Conference mode screencast uses 2 temporal layers split at 100kbit.
1858 if (parameters_.options.conference_mode.value_or(false) && 1872 if (parameters_.conference_mode && dimensions.is_screencast &&
1859 dimensions.is_screencast && encoder_config.streams.size() == 1) { 1873 encoder_config.streams.size() == 1) {
1860 ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault(); 1874 ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault();
1861 1875
1862 // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked 1876 // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked
1863 // on the VideoCodec struct as target and max bitrates, respectively. 1877 // on the VideoCodec struct as target and max bitrates, respectively.
1864 // See eg. webrtc::VP8EncoderImpl::SetRates(). 1878 // See eg. webrtc::VP8EncoderImpl::SetRates().
1865 encoder_config.streams[0].target_bitrate_bps = 1879 encoder_config.streams[0].target_bitrate_bps =
1866 config.tl0_bitrate_kbps * 1000; 1880 config.tl0_bitrate_kbps * 1000;
1867 encoder_config.streams[0].max_bitrate_bps = config.tl1_bitrate_kbps * 1000; 1881 encoder_config.streams[0].max_bitrate_bps = config.tl1_bitrate_kbps * 1000;
1868 encoder_config.streams[0].temporal_layer_thresholds_bps.clear(); 1882 encoder_config.streams[0].temporal_layer_thresholds_bps.clear();
1869 encoder_config.streams[0].temporal_layer_thresholds_bps.push_back( 1883 encoder_config.streams[0].temporal_layer_thresholds_bps.push_back(
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 rtx_mapping[video_codecs[i].codec.id] != 2497 rtx_mapping[video_codecs[i].codec.id] !=
2484 fec_settings.red_payload_type) { 2498 fec_settings.red_payload_type) {
2485 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2499 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2486 } 2500 }
2487 } 2501 }
2488 2502
2489 return video_codecs; 2503 return video_codecs;
2490 } 2504 }
2491 2505
2492 } // namespace cricket 2506 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698