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 2368223002: Add VideoSendStream::Stats::prefered_media_bitrate_bps (Closed)
Patch Set: Addressed nits Created 4 years, 2 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
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 VideoSenderInfo info; 2145 VideoSenderInfo info;
2146 webrtc::VideoSendStream::Stats stats; 2146 webrtc::VideoSendStream::Stats stats;
2147 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 2147 RTC_DCHECK(thread_checker_.CalledOnValidThread());
2148 { 2148 {
2149 rtc::CritScope cs(&lock_); 2149 rtc::CritScope cs(&lock_);
2150 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) 2150 for (uint32_t ssrc : parameters_.config.rtp.ssrcs)
2151 info.add_ssrc(ssrc); 2151 info.add_ssrc(ssrc);
2152 2152
2153 if (parameters_.codec_settings) 2153 if (parameters_.codec_settings)
2154 info.codec_name = parameters_.codec_settings->codec.name; 2154 info.codec_name = parameters_.codec_settings->codec.name;
2155 for (size_t i = 0; i < parameters_.encoder_config.streams.size(); ++i) {
2156 if (i == parameters_.encoder_config.streams.size() - 1) {
2157 info.preferred_bitrate +=
2158 parameters_.encoder_config.streams[i].max_bitrate_bps;
2159 } else {
2160 info.preferred_bitrate +=
2161 parameters_.encoder_config.streams[i].target_bitrate_bps;
2162 }
2163 }
2164 2155
2165 if (stream_ == NULL) 2156 if (stream_ == NULL)
2166 return info; 2157 return info;
2167 2158
2168 stats = stream_->GetStats(); 2159 stats = stream_->GetStats();
2169 } 2160 }
2170 2161
2171 if (log_stats) 2162 if (log_stats)
2172 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); 2163 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis());
2173 2164
2174 info.adapt_changes = number_of_cpu_adapt_changes_; 2165 info.adapt_changes = number_of_cpu_adapt_changes_;
2175 info.adapt_reason = 2166 info.adapt_reason =
2176 cpu_restricted_counter_ <= 0 ? ADAPTREASON_NONE : ADAPTREASON_CPU; 2167 cpu_restricted_counter_ <= 0 ? ADAPTREASON_NONE : ADAPTREASON_CPU;
2177 2168
2178 // Get bandwidth limitation info from stream_->GetStats(). 2169 // Get bandwidth limitation info from stream_->GetStats().
2179 // Input resolution (output from video_adapter) can be further scaled down or 2170 // Input resolution (output from video_adapter) can be further scaled down or
2180 // higher video layer(s) can be dropped due to bitrate constraints. 2171 // higher video layer(s) can be dropped due to bitrate constraints.
2181 // Note, adapt_changes only include changes from the video_adapter. 2172 // Note, adapt_changes only include changes from the video_adapter.
2182 if (stats.bw_limited_resolution) 2173 if (stats.bw_limited_resolution)
2183 info.adapt_reason |= ADAPTREASON_BANDWIDTH; 2174 info.adapt_reason |= ADAPTREASON_BANDWIDTH;
2184 2175
2185 info.encoder_implementation_name = stats.encoder_implementation_name; 2176 info.encoder_implementation_name = stats.encoder_implementation_name;
2186 info.ssrc_groups = ssrc_groups_; 2177 info.ssrc_groups = ssrc_groups_;
2187 info.framerate_input = stats.input_frame_rate; 2178 info.framerate_input = stats.input_frame_rate;
2188 info.framerate_sent = stats.encode_frame_rate; 2179 info.framerate_sent = stats.encode_frame_rate;
2189 info.avg_encode_ms = stats.avg_encode_time_ms; 2180 info.avg_encode_ms = stats.avg_encode_time_ms;
2190 info.encode_usage_percent = stats.encode_usage_percent; 2181 info.encode_usage_percent = stats.encode_usage_percent;
2191 2182
2192 info.nominal_bitrate = stats.media_bitrate_bps; 2183 info.nominal_bitrate = stats.media_bitrate_bps;
2184 info.preferred_bitrate = stats.preferred_media_bitrate_bps;
2193 2185
2194 info.send_frame_width = 0; 2186 info.send_frame_width = 0;
2195 info.send_frame_height = 0; 2187 info.send_frame_height = 0;
2196 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = 2188 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it =
2197 stats.substreams.begin(); 2189 stats.substreams.begin();
2198 it != stats.substreams.end(); ++it) { 2190 it != stats.substreams.end(); ++it) {
2199 // TODO(pbos): Wire up additional stats, such as padding bytes. 2191 // TODO(pbos): Wire up additional stats, such as padding bytes.
2200 webrtc::VideoSendStream::StreamStats stream_stats = it->second; 2192 webrtc::VideoSendStream::StreamStats stream_stats = it->second;
2201 info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes + 2193 info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes +
2202 stream_stats.rtp_stats.transmitted.header_bytes + 2194 stream_stats.rtp_stats.transmitted.header_bytes +
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 rtx_mapping[video_codecs[i].codec.id] != 2706 rtx_mapping[video_codecs[i].codec.id] !=
2715 fec_settings.red_payload_type) { 2707 fec_settings.red_payload_type) {
2716 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2708 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2717 } 2709 }
2718 } 2710 }
2719 2711
2720 return video_codecs; 2712 return video_codecs;
2721 } 2713 }
2722 2714
2723 } // namespace cricket 2715 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698