OLD | NEW |
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 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 VideoSenderInfo info; | 2141 VideoSenderInfo info; |
2142 webrtc::VideoSendStream::Stats stats; | 2142 webrtc::VideoSendStream::Stats stats; |
2143 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 2143 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
2144 { | 2144 { |
2145 rtc::CritScope cs(&lock_); | 2145 rtc::CritScope cs(&lock_); |
2146 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) | 2146 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) |
2147 info.add_ssrc(ssrc); | 2147 info.add_ssrc(ssrc); |
2148 | 2148 |
2149 if (parameters_.codec_settings) | 2149 if (parameters_.codec_settings) |
2150 info.codec_name = parameters_.codec_settings->codec.name; | 2150 info.codec_name = parameters_.codec_settings->codec.name; |
2151 for (size_t i = 0; i < parameters_.encoder_config.streams.size(); ++i) { | |
2152 if (i == parameters_.encoder_config.streams.size() - 1) { | |
2153 info.preferred_bitrate += | |
2154 parameters_.encoder_config.streams[i].max_bitrate_bps; | |
2155 } else { | |
2156 info.preferred_bitrate += | |
2157 parameters_.encoder_config.streams[i].target_bitrate_bps; | |
2158 } | |
2159 } | |
2160 | 2151 |
2161 if (stream_ == NULL) | 2152 if (stream_ == NULL) |
2162 return info; | 2153 return info; |
2163 | 2154 |
2164 stats = stream_->GetStats(); | 2155 stats = stream_->GetStats(); |
2165 } | 2156 } |
2166 | 2157 |
2167 if (log_stats) | 2158 if (log_stats) |
2168 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); | 2159 LOG(LS_INFO) << stats.ToString(rtc::TimeMillis()); |
2169 | 2160 |
2170 info.adapt_changes = number_of_cpu_adapt_changes_; | 2161 info.adapt_changes = number_of_cpu_adapt_changes_; |
2171 info.adapt_reason = | 2162 info.adapt_reason = |
2172 cpu_restricted_counter_ <= 0 ? ADAPTREASON_NONE : ADAPTREASON_CPU; | 2163 cpu_restricted_counter_ <= 0 ? ADAPTREASON_NONE : ADAPTREASON_CPU; |
2173 | 2164 |
2174 // Get bandwidth limitation info from stream_->GetStats(). | 2165 // Get bandwidth limitation info from stream_->GetStats(). |
2175 // Input resolution (output from video_adapter) can be further scaled down or | 2166 // Input resolution (output from video_adapter) can be further scaled down or |
2176 // higher video layer(s) can be dropped due to bitrate constraints. | 2167 // higher video layer(s) can be dropped due to bitrate constraints. |
2177 // Note, adapt_changes only include changes from the video_adapter. | 2168 // Note, adapt_changes only include changes from the video_adapter. |
2178 if (stats.bw_limited_resolution) | 2169 if (stats.bw_limited_resolution) |
2179 info.adapt_reason |= ADAPTREASON_BANDWIDTH; | 2170 info.adapt_reason |= ADAPTREASON_BANDWIDTH; |
2180 | 2171 |
2181 info.encoder_implementation_name = stats.encoder_implementation_name; | 2172 info.encoder_implementation_name = stats.encoder_implementation_name; |
2182 info.ssrc_groups = ssrc_groups_; | 2173 info.ssrc_groups = ssrc_groups_; |
2183 info.framerate_input = stats.input_frame_rate; | 2174 info.framerate_input = stats.input_frame_rate; |
2184 info.framerate_sent = stats.encode_frame_rate; | 2175 info.framerate_sent = stats.encode_frame_rate; |
2185 info.avg_encode_ms = stats.avg_encode_time_ms; | 2176 info.avg_encode_ms = stats.avg_encode_time_ms; |
2186 info.encode_usage_percent = stats.encode_usage_percent; | 2177 info.encode_usage_percent = stats.encode_usage_percent; |
2187 | 2178 |
2188 info.nominal_bitrate = stats.media_bitrate_bps; | 2179 info.nominal_bitrate = stats.media_bitrate_bps; |
| 2180 info.preferred_bitrate = stats.preferred_media_bitrate_bps; |
2189 | 2181 |
2190 info.send_frame_width = 0; | 2182 info.send_frame_width = 0; |
2191 info.send_frame_height = 0; | 2183 info.send_frame_height = 0; |
2192 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = | 2184 for (std::map<uint32_t, webrtc::VideoSendStream::StreamStats>::iterator it = |
2193 stats.substreams.begin(); | 2185 stats.substreams.begin(); |
2194 it != stats.substreams.end(); ++it) { | 2186 it != stats.substreams.end(); ++it) { |
2195 // TODO(pbos): Wire up additional stats, such as padding bytes. | 2187 // TODO(pbos): Wire up additional stats, such as padding bytes. |
2196 webrtc::VideoSendStream::StreamStats stream_stats = it->second; | 2188 webrtc::VideoSendStream::StreamStats stream_stats = it->second; |
2197 info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes + | 2189 info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes + |
2198 stream_stats.rtp_stats.transmitted.header_bytes + | 2190 stream_stats.rtp_stats.transmitted.header_bytes + |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 rtx_mapping[video_codecs[i].codec.id] != | 2702 rtx_mapping[video_codecs[i].codec.id] != |
2711 fec_settings.red_payload_type) { | 2703 fec_settings.red_payload_type) { |
2712 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2704 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2713 } | 2705 } |
2714 } | 2706 } |
2715 | 2707 |
2716 return video_codecs; | 2708 return video_codecs; |
2717 } | 2709 } |
2718 | 2710 |
2719 } // namespace cricket | 2711 } // namespace cricket |
OLD | NEW |