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

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

Issue 1695663003: Drop VideoOptions from VideoSendParameters. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 options.
737 // TODO(pbos): Require VideoSendParameters to contain a full set of options
738 // and check if params.options != options_ instead of applying a delta.
739 VideoOptions new_options = options_;
740 new_options.SetAll(params.options);
741 if (!(new_options == options_)) {
742 changed_params->options = rtc::Optional<VideoOptions>(new_options);
743 }
744
745 // Handle RTCP mode. 736 // Handle RTCP mode.
746 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) { 737 if (params.rtcp.reduced_size != send_params_.rtcp.reduced_size) {
747 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>( 738 changed_params->rtcp_mode = rtc::Optional<webrtc::RtcpMode>(
748 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize 739 params.rtcp.reduced_size ? webrtc::RtcpMode::kReducedSize
749 : webrtc::RtcpMode::kCompound); 740 : webrtc::RtcpMode::kCompound);
750 } 741 }
751 742
752 return true; 743 return true;
753 } 744 }
754 745
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 bitrate_config_.min_bitrate_bps > max_bitrate_bps) { 784 bitrate_config_.min_bitrate_bps > max_bitrate_bps) {
794 bitrate_config_.min_bitrate_bps = max_bitrate_bps; 785 bitrate_config_.min_bitrate_bps = max_bitrate_bps;
795 } 786 }
796 bitrate_config_changed = true; 787 bitrate_config_changed = true;
797 } 788 }
798 789
799 if (bitrate_config_changed) { 790 if (bitrate_config_changed) {
800 call_->SetBitrateConfig(bitrate_config_); 791 call_->SetBitrateConfig(bitrate_config_);
801 } 792 }
802 793
803 if (changed_params.options)
804 options_.SetAll(*changed_params.options);
805
806 { 794 {
807 rtc::CritScope stream_lock(&stream_crit_); 795 rtc::CritScope stream_lock(&stream_crit_);
808 for (auto& kv : send_streams_) { 796 for (auto& kv : send_streams_) {
809 kv.second->SetSendParameters(changed_params); 797 kv.second->SetSendParameters(changed_params);
810 } 798 }
811 if (changed_params.codec) { 799 if (changed_params.codec) {
812 // Update receive feedback parameters from new codec. 800 // Update receive feedback parameters from new codec.
813 LOG(LS_INFO) 801 LOG(LS_INFO)
814 << "SetFeedbackOptions on all the receive streams because the send " 802 << "SetFeedbackOptions on all the receive streams because the send "
815 "codec has changed."; 803 "codec has changed.";
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable 931 LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable
944 << "options: " << (options ? options->ToString() : "nullptr") 932 << "options: " << (options ? options->ToString() : "nullptr")
945 << ")."; 933 << ").";
946 934
947 // TODO(solenberg): The state change should be fully rolled back if any one of 935 // TODO(solenberg): The state change should be fully rolled back if any one of
948 // these calls fail. 936 // these calls fail.
949 if (!MuteStream(ssrc, !enable)) { 937 if (!MuteStream(ssrc, !enable)) {
950 return false; 938 return false;
951 } 939 }
952 if (enable && options) { 940 if (enable && options) {
953 VideoSendParameters new_params = send_params_; 941 SetOptions(ssrc, *options);
954 new_params.options.SetAll(*options);
955 SetSendParameters(send_params_);
956 } 942 }
957 return true; 943 return true;
958 } 944 }
959 945
960 bool WebRtcVideoChannel2::ValidateSendSsrcAvailability( 946 bool WebRtcVideoChannel2::ValidateSendSsrcAvailability(
961 const StreamParams& sp) const { 947 const StreamParams& sp) const {
962 for (uint32_t ssrc : sp.ssrcs) { 948 for (uint32_t ssrc : sp.ssrcs) {
963 if (send_ssrcs_.find(ssrc) != send_ssrcs_.end()) { 949 if (send_ssrcs_.find(ssrc) != send_ssrcs_.end()) {
964 LOG(LS_ERROR) << "Send stream with SSRC '" << ssrc << "' already exists."; 950 LOG(LS_ERROR) << "Send stream with SSRC '" << ssrc << "' already exists.";
965 return false; 951 return false;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 if (send_streams_.find(ssrc) == send_streams_.end()) { 1355 if (send_streams_.find(ssrc) == send_streams_.end()) {
1370 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; 1356 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc;
1371 return false; 1357 return false;
1372 } 1358 }
1373 1359
1374 send_streams_[ssrc]->MuteStream(mute); 1360 send_streams_[ssrc]->MuteStream(mute);
1375 return true; 1361 return true;
1376 } 1362 }
1377 1363
1378 // TODO(pbos): Remove SetOptions in favor of SetSendParameters. 1364 // TODO(pbos): Remove SetOptions in favor of SetSendParameters.
1379 void WebRtcVideoChannel2::SetOptions(const VideoOptions& options) { 1365 void WebRtcVideoChannel2::SetOptions(uint32_t ssrc,
1380 VideoSendParameters new_params = send_params_; 1366 const VideoOptions& options) {
1381 new_params.options.SetAll(options); 1367 LOG(LS_INFO) << "SetOptions: ssrc " << ssrc << ": " << options.ToString();
1382 SetSendParameters(send_params_); 1368
1369 rtc::CritScope stream_lock(&stream_crit_);
1370 if (send_streams_.find(ssrc) == send_streams_.end()) {
1371 return;
1372 }
1373 send_streams_[ssrc]->SetOptions(options);
1383 } 1374 }
1384 1375
1385 void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) { 1376 void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) {
1386 MediaChannel::SetInterface(iface); 1377 MediaChannel::SetInterface(iface);
1387 // Set the RTP recv/send buffer to a bigger size 1378 // Set the RTP recv/send buffer to a bigger size
1388 MediaChannel::SetOption(NetworkInterface::ST_RTP, 1379 MediaChannel::SetOption(NetworkInterface::ST_RTP,
1389 rtc::Socket::OPT_RCVBUF, 1380 rtc::Socket::OPT_RCVBUF,
1390 kVideoRtpBufferSize); 1381 kVideoRtpBufferSize);
1391 1382
1392 // Speculative change to increase the outbound socket buffer size. 1383 // Speculative change to increase the outbound socket buffer size.
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 recreate_stream = true; 1778 recreate_stream = true;
1788 } 1779 }
1789 if (params.max_bandwidth_bps) { 1780 if (params.max_bandwidth_bps) {
1790 // Max bitrate has changed, reconfigure encoder settings on the next frame 1781 // Max bitrate has changed, reconfigure encoder settings on the next frame
1791 // or stream recreation. 1782 // or stream recreation.
1792 parameters_.max_bitrate_bps = *params.max_bandwidth_bps; 1783 parameters_.max_bitrate_bps = *params.max_bandwidth_bps;
1793 pending_encoder_reconfiguration_ = true; 1784 pending_encoder_reconfiguration_ = true;
1794 } 1785 }
1795 // Set codecs and options. 1786 // Set codecs and options.
1796 if (params.codec) { 1787 if (params.codec) {
1797 SetCodecAndOptions(*params.codec, 1788 SetCodecAndOptions(*params.codec, parameters_.options);
1798 params.options ? *params.options : parameters_.options);
1799 return; 1789 return;
1800 } else if (params.options) {
1801 // Reconfigure if codecs are already set.
1802 if (parameters_.codec_settings) {
1803 SetCodecAndOptions(*parameters_.codec_settings, *params.options);
1804 return;
1805 } else {
1806 parameters_.options = *params.options;
1807 }
1808 } 1790 }
1809 if (recreate_stream) { 1791 if (recreate_stream) {
1810 LOG(LS_INFO) << "RecreateWebRtcStream (send) because of SetSendParameters"; 1792 LOG(LS_INFO) << "RecreateWebRtcStream (send) because of SetSendParameters";
1811 RecreateWebRtcStream(); 1793 RecreateWebRtcStream();
1812 } 1794 }
1813 } 1795 }
1814 1796
1815 webrtc::VideoEncoderConfig 1797 webrtc::VideoEncoderConfig
1816 WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig( 1798 WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig(
1817 const Dimensions& dimensions, 1799 const Dimensions& dimensions,
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 rtx_mapping[video_codecs[i].codec.id] != 2465 rtx_mapping[video_codecs[i].codec.id] !=
2484 fec_settings.red_payload_type) { 2466 fec_settings.red_payload_type) {
2485 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2467 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2486 } 2468 }
2487 } 2469 }
2488 2470
2489 return video_codecs; 2471 return video_codecs;
2490 } 2472 }
2491 2473
2492 } // namespace cricket 2474 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698