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

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

Issue 1836043004: Cleanup the VideoAdapter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 recreate_stream = false; // SetCodec has already recreated the stream. 1818 recreate_stream = false; // SetCodec has already recreated the stream.
1819 } else if (params.conference_mode && parameters_.codec_settings) { 1819 } else if (params.conference_mode && parameters_.codec_settings) {
1820 SetCodec(*parameters_.codec_settings); 1820 SetCodec(*parameters_.codec_settings);
1821 recreate_stream = false; // SetCodec has already recreated the stream. 1821 recreate_stream = false; // SetCodec has already recreated the stream.
1822 } 1822 }
1823 if (recreate_stream) { 1823 if (recreate_stream) {
1824 LOG(LS_INFO) 1824 LOG(LS_INFO)
1825 << "RecreateWebRtcStream (send) because of SetSendParameters"; 1825 << "RecreateWebRtcStream (send) because of SetSendParameters";
1826 RecreateWebRtcStream(); 1826 RecreateWebRtcStream();
1827 } 1827 }
1828 } // release |lock_| 1828 } // release |lock_|
1829 1829
1830 // |capturer_->AddOrUpdateSink| may not be called while holding |lock_| since 1830 // |capturer_->AddOrUpdateSink| may not be called while holding |lock_| since
1831 // that might cause a lock order inversion. 1831 // that might cause a lock order inversion.
1832 if (params.rtp_header_extensions) { 1832 if (params.rtp_header_extensions) {
1833 sink_wants_.rotation_applied = !ContainsHeaderExtension( 1833 sink_wants_.rotation_applied = !ContainsHeaderExtension(
1834 *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension); 1834 *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension);
1835 if (capturer_) { 1835 if (capturer_) {
1836 capturer_->AddOrUpdateSink(this, sink_wants_); 1836 capturer_->AddOrUpdateSink(this, sink_wants_);
1837 } 1837 }
1838 } 1838 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 : "false") 2009 : "false")
2010 : "unset"); 2010 : "unset");
2011 // Do not adapt resolution for screen content as this will likely result in 2011 // Do not adapt resolution for screen content as this will likely result in
2012 // blurry and unreadable text. 2012 // blurry and unreadable text.
2013 if (parameters_.options.is_screencast.value_or(false)) 2013 if (parameters_.options.is_screencast.value_or(false))
2014 return; 2014 return;
2015 2015
2016 rtc::Optional<int> max_pixel_count; 2016 rtc::Optional<int> max_pixel_count;
2017 rtc::Optional<int> max_pixel_count_step_up; 2017 rtc::Optional<int> max_pixel_count_step_up;
2018 if (load == kOveruse) { 2018 if (load == kOveruse) {
2019 max_pixel_count = rtc::Optional<int>( 2019 max_pixel_count = rtc::Optional<int>(
2020 (last_dimensions_.height * last_dimensions_.width) / 2); 2020 (last_dimensions_.height * last_dimensions_.width * 3) / 5);
2021 // Increase |number_of_cpu_adapt_changes_| if 2021 // Increase |number_of_cpu_adapt_changes_| if
2022 // sink_wants_.max_pixel_count will be changed since 2022 // sink_wants_.max_pixel_count will be changed since
2023 // last time |capturer_->AddOrUpdateSink| was called. That is, this will 2023 // last time |capturer_->AddOrUpdateSink| was called. That is, this will
2024 // result in a new request for the capturer to change resolution. 2024 // result in a new request for the capturer to change resolution.
2025 if (!sink_wants_.max_pixel_count || 2025 if (!sink_wants_.max_pixel_count ||
2026 *sink_wants_.max_pixel_count > *max_pixel_count) { 2026 *sink_wants_.max_pixel_count > *max_pixel_count) {
2027 ++number_of_cpu_adapt_changes_; 2027 ++number_of_cpu_adapt_changes_;
2028 ++cpu_restricted_counter_; 2028 ++cpu_restricted_counter_;
2029 } 2029 }
2030 } else { 2030 } else {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 parameters_.encoder_config.streams[i].target_bitrate_bps; 2071 parameters_.encoder_config.streams[i].target_bitrate_bps;
2072 } 2072 }
2073 } 2073 }
2074 2074
2075 if (stream_ == NULL) 2075 if (stream_ == NULL)
2076 return info; 2076 return info;
2077 2077
2078 stats = stream_->GetStats(); 2078 stats = stream_->GetStats();
2079 } 2079 }
2080 info.adapt_changes = number_of_cpu_adapt_changes_; 2080 info.adapt_changes = number_of_cpu_adapt_changes_;
2081 info.adapt_reason = cpu_restricted_counter_ <= 0 2081 info.adapt_reason =
2082 ? CoordinatedVideoAdapter::ADAPTREASON_NONE 2082 cpu_restricted_counter_ <= 0 ? ADAPTREASON_NONE : ADAPTREASON_CPU;
2083 : CoordinatedVideoAdapter::ADAPTREASON_CPU;
2084 2083
2085 if (capturer_) { 2084 if (capturer_) {
2086 VideoFormat last_captured_frame_format; 2085 VideoFormat last_captured_frame_format;
2087 capturer_->GetStats(&last_captured_frame_format); 2086 capturer_->GetStats(&last_captured_frame_format);
2088 info.input_frame_width = last_captured_frame_format.width; 2087 info.input_frame_width = last_captured_frame_format.width;
2089 info.input_frame_height = last_captured_frame_format.height; 2088 info.input_frame_height = last_captured_frame_format.height;
2090 } 2089 }
2091 2090
2092 // Get bandwidth limitation info from stream_->GetStats(). 2091 // Get bandwidth limitation info from stream_->GetStats().
2093 // Input resolution (output from video_adapter) can be further scaled down or 2092 // Input resolution (output from video_adapter) can be further scaled down or
2094 // higher video layer(s) can be dropped due to bitrate constraints. 2093 // higher video layer(s) can be dropped due to bitrate constraints.
2095 // Note, adapt_changes only include changes from the video_adapter. 2094 // Note, adapt_changes only include changes from the video_adapter.
2096 if (stats.bw_limited_resolution) 2095 if (stats.bw_limited_resolution)
2097 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; 2096 info.adapt_reason |= ADAPTREASON_BANDWIDTH;
2098 2097
2099 info.encoder_implementation_name = stats.encoder_implementation_name; 2098 info.encoder_implementation_name = stats.encoder_implementation_name;
2100 info.ssrc_groups = ssrc_groups_; 2099 info.ssrc_groups = ssrc_groups_;
2101 info.framerate_input = stats.input_frame_rate; 2100 info.framerate_input = stats.input_frame_rate;
2102 info.framerate_sent = stats.encode_frame_rate; 2101 info.framerate_sent = stats.encode_frame_rate;
2103 info.avg_encode_ms = stats.avg_encode_time_ms; 2102 info.avg_encode_ms = stats.avg_encode_time_ms;
2104 info.encode_usage_percent = stats.encode_usage_percent; 2103 info.encode_usage_percent = stats.encode_usage_percent;
2105 2104
2106 info.nominal_bitrate = stats.media_bitrate_bps; 2105 info.nominal_bitrate = stats.media_bitrate_bps;
2107 2106
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 rtx_mapping[video_codecs[i].codec.id] != 2585 rtx_mapping[video_codecs[i].codec.id] !=
2587 fec_settings.red_payload_type) { 2586 fec_settings.red_payload_type) {
2588 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2587 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2589 } 2588 }
2590 } 2589 }
2591 2590
2592 return video_codecs; 2591 return video_codecs;
2593 } 2592 }
2594 2593
2595 } // namespace cricket 2594 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698