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

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

Issue 2740783006: Support removing b=AS bandwidth constraints. (Closed)
Patch Set: Created 3 years, 9 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 // Handle RTP header extensions. 708 // Handle RTP header extensions.
709 std::vector<webrtc::RtpExtension> filtered_extensions = FilterRtpExtensions( 709 std::vector<webrtc::RtpExtension> filtered_extensions = FilterRtpExtensions(
710 params.extensions, webrtc::RtpExtension::IsSupportedForVideo, true); 710 params.extensions, webrtc::RtpExtension::IsSupportedForVideo, true);
711 if (!send_rtp_extensions_ || (*send_rtp_extensions_ != filtered_extensions)) { 711 if (!send_rtp_extensions_ || (*send_rtp_extensions_ != filtered_extensions)) {
712 changed_params->rtp_header_extensions = 712 changed_params->rtp_header_extensions =
713 rtc::Optional<std::vector<webrtc::RtpExtension>>(filtered_extensions); 713 rtc::Optional<std::vector<webrtc::RtpExtension>>(filtered_extensions);
714 } 714 }
715 715
716 // Handle max bitrate. 716 // Handle max bitrate.
717 if (params.max_bandwidth_bps != send_params_.max_bandwidth_bps && 717 if (params.max_bandwidth_bps != send_params_.max_bandwidth_bps &&
718 params.max_bandwidth_bps >= 0) { 718 params.max_bandwidth_bps >= -1) {
719 // 0 uncaps max bitrate (-1). 719 // 0 or -1 uncaps max bitrate.
720 // TODO(pbos): Reconsider whether 0 should be invalid or not. -1 is the
721 // auto-bitrate value.
Taylor Brandstetter 2017/03/09 23:48:38 The "correct" behavior for b=AS:0 may be "set bitr
pbos-webrtc 2017/03/10 18:52:09 TODO text updated.
720 changed_params->max_bandwidth_bps = rtc::Optional<int>( 722 changed_params->max_bandwidth_bps = rtc::Optional<int>(
721 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps); 723 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps);
722 } 724 }
723 725
724 // Handle conference mode. 726 // Handle conference mode.
725 if (params.conference_mode != send_params_.conference_mode) { 727 if (params.conference_mode != send_params_.conference_mode) {
726 changed_params->conference_mode = 728 changed_params->conference_mode =
727 rtc::Optional<bool>(params.conference_mode); 729 rtc::Optional<bool>(params.conference_mode);
728 } 730 }
729 731
(...skipping 25 matching lines...) Expand all
755 LOG(LS_INFO) << "Using codec: " << codec_settings.codec.ToString(); 757 LOG(LS_INFO) << "Using codec: " << codec_settings.codec.ToString();
756 } 758 }
757 759
758 if (changed_params.rtp_header_extensions) { 760 if (changed_params.rtp_header_extensions) {
759 send_rtp_extensions_ = changed_params.rtp_header_extensions; 761 send_rtp_extensions_ = changed_params.rtp_header_extensions;
760 } 762 }
761 763
762 if (changed_params.codec || changed_params.max_bandwidth_bps) { 764 if (changed_params.codec || changed_params.max_bandwidth_bps) {
763 if (send_codec_) { 765 if (send_codec_) {
764 // TODO(holmer): Changing the codec parameters shouldn't necessarily mean 766 // TODO(holmer): Changing the codec parameters shouldn't necessarily mean
765 // that we change the min/max of bandwidth estimation. Reevaluate this. 767 // that we change the min of bandwidth estimation. Reevaluate this.
766 bitrate_config_ = GetBitrateConfigForCodec(send_codec_->codec); 768 bitrate_config_ = GetBitrateConfigForCodec(send_codec_->codec);
767 if (!changed_params.codec) { 769 if (!changed_params.codec) {
768 // If the codec isn't changing, set the start bitrate to -1 which means 770 // If the codec isn't changing, set the start bitrate to -1 which means
769 // "unchanged" so that BWE isn't affected. 771 // "unchanged" so that BWE isn't affected.
770 bitrate_config_.start_bitrate_bps = -1; 772 bitrate_config_.start_bitrate_bps = -1;
771 } 773 }
772 } 774 }
773 if (params.max_bandwidth_bps >= 0) { 775 if (params.max_bandwidth_bps >= -1) {
774 // Note that max_bandwidth_bps intentionally takes priority over the 776 // Note that max_bandwidth_bps intentionally takes priority over the
775 // bitrate config for the codec. This allows FEC to be applied above the 777 // bitrate config for the codec. This allows FEC to be applied above the
776 // codec target bitrate. 778 // codec target bitrate.
777 // TODO(pbos): Figure out whether b=AS means max bitrate for this 779 // TODO(pbos): Figure out whether b=AS means max bitrate for this
778 // WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC), 780 // WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC),
779 // in which case this should not set a Call::BitrateConfig but rather 781 // in which case this should not set a Call::BitrateConfig but rather
780 // reconfigure all senders. 782 // reconfigure all senders.
783
784 // TODO(pbos): Consider whether 0 should be invalid or not.
785 // 0 or -1 uncaps max bitrate.
781 bitrate_config_.max_bitrate_bps = 786 bitrate_config_.max_bitrate_bps =
782 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps; 787 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
783 } 788 }
784 call_->SetBitrateConfig(bitrate_config_); 789 call_->SetBitrateConfig(bitrate_config_);
785 } 790 }
786 791
787 { 792 {
788 rtc::CritScope stream_lock(&stream_crit_); 793 rtc::CritScope stream_lock(&stream_crit_);
789 for (auto& kv : send_streams_) { 794 for (auto& kv : send_streams_) {
790 kv.second->SetSendParameters(changed_params); 795 kv.second->SetSendParameters(changed_params);
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 rtx_mapping[video_codecs[i].codec.id] != 2553 rtx_mapping[video_codecs[i].codec.id] !=
2549 ulpfec_config.red_payload_type) { 2554 ulpfec_config.red_payload_type) {
2550 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2555 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2551 } 2556 }
2552 } 2557 }
2553 2558
2554 return video_codecs; 2559 return video_codecs;
2555 } 2560 }
2556 2561
2557 } // namespace cricket 2562 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698