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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 1311533012: Add histogram for percentage of sent frames that are limited in resolution due to bandwidth. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 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/video/send_statistics_proxy.h » ('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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return false; 124 return false;
125 } 125 }
126 for (int i = 0; i < num_streams; ++i) { 126 for (int i = 0; i < num_streams; ++i) {
127 if (codec.width * codec.simulcastStream[i].height != 127 if (codec.width * codec.simulcastStream[i].height !=
128 codec.height * codec.simulcastStream[i].width) { 128 codec.height * codec.simulcastStream[i].width) {
129 return false; 129 return false;
130 } 130 }
131 } 131 }
132 return true; 132 return true;
133 } 133 }
134
135 int NumStreamsDisabled(std::vector<bool>& streams) {
136 int num_disabled = 0;
137 for (bool stream : streams) {
138 if (!stream)
139 ++num_disabled;
140 }
141 return num_disabled;
142 }
134 } // namespace 143 } // namespace
135 144
136 const float kTl1MaxTimeToDropFrames = 20.0f; 145 const float kTl1MaxTimeToDropFrames = 20.0f;
137 146
138 VP8EncoderImpl::VP8EncoderImpl() 147 VP8EncoderImpl::VP8EncoderImpl()
139 : encoded_complete_callback_(NULL), 148 : encoded_complete_callback_(NULL),
140 inited_(false), 149 inited_(false),
141 timestamp_(0), 150 timestamp_(0),
142 feedback_mode_(false), 151 feedback_mode_(false),
143 qp_max_(56), // Setting for max quantizer. 152 qp_max_(56), // Setting for max quantizer.
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 only_predicting_from_key_frame; 953 only_predicting_from_key_frame;
945 temporal_layers_[stream_idx]->PopulateCodecSpecific(base_layer_sync_point, 954 temporal_layers_[stream_idx]->PopulateCodecSpecific(base_layer_sync_point,
946 vp8Info, 955 vp8Info,
947 timestamp); 956 timestamp);
948 // Prepare next. 957 // Prepare next.
949 picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF; 958 picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF;
950 } 959 }
951 960
952 int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image, 961 int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image,
953 bool only_predicting_from_key_frame) { 962 bool only_predicting_from_key_frame) {
963 int bw_resolutions_disabled =
964 (encoders_.size() > 1) ? NumStreamsDisabled(send_stream_) : -1;
965
954 int stream_idx = static_cast<int>(encoders_.size()) - 1; 966 int stream_idx = static_cast<int>(encoders_.size()) - 1;
955 int result = WEBRTC_VIDEO_CODEC_OK; 967 int result = WEBRTC_VIDEO_CODEC_OK;
956 for (size_t encoder_idx = 0; encoder_idx < encoders_.size(); 968 for (size_t encoder_idx = 0; encoder_idx < encoders_.size();
957 ++encoder_idx, --stream_idx) { 969 ++encoder_idx, --stream_idx) {
958 vpx_codec_iter_t iter = NULL; 970 vpx_codec_iter_t iter = NULL;
959 int part_idx = 0; 971 int part_idx = 0;
960 encoded_images_[encoder_idx]._length = 0; 972 encoded_images_[encoder_idx]._length = 0;
961 encoded_images_[encoder_idx]._frameType = kDeltaFrame; 973 encoded_images_[encoder_idx]._frameType = kDeltaFrame;
962 RTPFragmentationHeader frag_info; 974 RTPFragmentationHeader frag_info;
963 // token_partitions_ is number of bits used. 975 // token_partitions_ is number of bits used.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 if (encoded_images_[encoder_idx]._length > 0) { 1023 if (encoded_images_[encoder_idx]._length > 0) {
1012 TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx, 1024 TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx,
1013 encoded_images_[encoder_idx]._length); 1025 encoded_images_[encoder_idx]._length);
1014 encoded_images_[encoder_idx]._encodedHeight = 1026 encoded_images_[encoder_idx]._encodedHeight =
1015 codec_.simulcastStream[stream_idx].height; 1027 codec_.simulcastStream[stream_idx].height;
1016 encoded_images_[encoder_idx]._encodedWidth = 1028 encoded_images_[encoder_idx]._encodedWidth =
1017 codec_.simulcastStream[stream_idx].width; 1029 codec_.simulcastStream[stream_idx].width;
1018 encoded_images_[encoder_idx] 1030 encoded_images_[encoder_idx]
1019 .adapt_reason_.quality_resolution_downscales = 1031 .adapt_reason_.quality_resolution_downscales =
1020 quality_scaler_enabled_ ? quality_scaler_.downscale_shift() : -1; 1032 quality_scaler_enabled_ ? quality_scaler_.downscale_shift() : -1;
1033 // Report once per frame (lowest stream always sent).
1034 encoded_images_[encoder_idx].adapt_reason_.bw_resolutions_disabled =
1035 (stream_idx == 0) ? bw_resolutions_disabled : -1;
1021 encoded_complete_callback_->Encoded(encoded_images_[encoder_idx], 1036 encoded_complete_callback_->Encoded(encoded_images_[encoder_idx],
1022 &codec_specific, &frag_info); 1037 &codec_specific, &frag_info);
1023 } else if (codec_.mode == kScreensharing) { 1038 } else if (codec_.mode == kScreensharing) {
1024 result = WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT; 1039 result = WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT;
1025 } 1040 }
1026 } 1041 }
1027 } 1042 }
1028 if (encoders_.size() == 1 && send_stream_[0]) { 1043 if (encoders_.size() == 1 && send_stream_[0]) {
1029 if (encoded_images_[0]._length > 0) { 1044 if (encoded_images_[0]._length > 0) {
1030 int qp; 1045 int qp;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 return -1; 1407 return -1;
1393 } 1408 }
1394 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) 1409 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_)
1395 != VPX_CODEC_OK) { 1410 != VPX_CODEC_OK) {
1396 return -1; 1411 return -1;
1397 } 1412 }
1398 return 0; 1413 return 0;
1399 } 1414 }
1400 1415
1401 } // namespace webrtc 1416 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/send_statistics_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698