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

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: Created 5 years, 3 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) 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 bool SendingAllStreams(std::vector<bool>& streams) {
136 for (bool stream : streams) {
137 if (!stream)
138 return false;
139 }
140 return true;
stefan-webrtc 2015/09/16 07:49:27 I think you could replace this with return std::fi
141 }
134 } // namespace 142 } // namespace
135 143
136 const float kTl1MaxTimeToDropFrames = 20.0f; 144 const float kTl1MaxTimeToDropFrames = 20.0f;
137 145
138 VP8EncoderImpl::VP8EncoderImpl() 146 VP8EncoderImpl::VP8EncoderImpl()
139 : encoded_complete_callback_(NULL), 147 : encoded_complete_callback_(NULL),
140 inited_(false), 148 inited_(false),
141 timestamp_(0), 149 timestamp_(0),
142 feedback_mode_(false), 150 feedback_mode_(false),
143 qp_max_(56), // Setting for max quantizer. 151 qp_max_(56), // Setting for max quantizer.
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 only_predicting_from_key_frame; 945 only_predicting_from_key_frame;
938 temporal_layers_[stream_idx]->PopulateCodecSpecific(base_layer_sync_point, 946 temporal_layers_[stream_idx]->PopulateCodecSpecific(base_layer_sync_point,
939 vp8Info, 947 vp8Info,
940 timestamp); 948 timestamp);
941 // Prepare next. 949 // Prepare next.
942 picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF; 950 picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF;
943 } 951 }
944 952
945 int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image, 953 int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image,
946 bool only_predicting_from_key_frame) { 954 bool only_predicting_from_key_frame) {
955 bool bw_limited_resolution = false;
956 bool bw_limited_resolution_available = encoders_.size() > 1;
957 if (bw_limited_resolution_available)
958 bw_limited_resolution = !SendingAllStreams(send_stream_);
stefan-webrtc 2015/09/16 07:49:27 Same reasoning as in the quality CL. Would it be u
åsapersson 2015/09/17 14:12:03 Done.
959
947 int stream_idx = static_cast<int>(encoders_.size()) - 1; 960 int stream_idx = static_cast<int>(encoders_.size()) - 1;
948 int result = WEBRTC_VIDEO_CODEC_OK; 961 int result = WEBRTC_VIDEO_CODEC_OK;
949 for (size_t encoder_idx = 0; encoder_idx < encoders_.size(); 962 for (size_t encoder_idx = 0; encoder_idx < encoders_.size();
950 ++encoder_idx, --stream_idx) { 963 ++encoder_idx, --stream_idx) {
951 vpx_codec_iter_t iter = NULL; 964 vpx_codec_iter_t iter = NULL;
952 int part_idx = 0; 965 int part_idx = 0;
953 encoded_images_[encoder_idx]._length = 0; 966 encoded_images_[encoder_idx]._length = 0;
954 encoded_images_[encoder_idx]._frameType = kDeltaFrame; 967 encoded_images_[encoder_idx]._frameType = kDeltaFrame;
955 RTPFragmentationHeader frag_info; 968 RTPFragmentationHeader frag_info;
956 // token_partitions_ is number of bits used. 969 // token_partitions_ is number of bits used.
(...skipping 30 matching lines...) Expand all
987 } 1000 }
988 PopulateCodecSpecific(&codec_specific, *pkt, stream_idx, 1001 PopulateCodecSpecific(&codec_specific, *pkt, stream_idx,
989 input_image.timestamp(), 1002 input_image.timestamp(),
990 only_predicting_from_key_frame); 1003 only_predicting_from_key_frame);
991 break; 1004 break;
992 } 1005 }
993 } 1006 }
994 encoded_images_[encoder_idx]._timeStamp = input_image.timestamp(); 1007 encoded_images_[encoder_idx]._timeStamp = input_image.timestamp();
995 encoded_images_[encoder_idx].capture_time_ms_ = 1008 encoded_images_[encoder_idx].capture_time_ms_ =
996 input_image.render_time_ms(); 1009 input_image.render_time_ms();
1010 encoded_images_[encoder_idx].adapt_reason_.bw_limited_resolution_available =
1011 bw_limited_resolution_available;
1012 encoded_images_[encoder_idx].adapt_reason_.bw_limited_resolution =
1013 bw_limited_resolution;
997 1014
998 int qp = -1; 1015 int qp = -1;
999 vpx_codec_control(&encoders_[encoder_idx], VP8E_GET_LAST_QUANTIZER_64, &qp); 1016 vpx_codec_control(&encoders_[encoder_idx], VP8E_GET_LAST_QUANTIZER_64, &qp);
1000 temporal_layers_[stream_idx]->FrameEncoded( 1017 temporal_layers_[stream_idx]->FrameEncoded(
1001 encoded_images_[encoder_idx]._length, 1018 encoded_images_[encoder_idx]._length,
1002 encoded_images_[encoder_idx]._timeStamp, qp); 1019 encoded_images_[encoder_idx]._timeStamp, qp);
1003 if (send_stream_[stream_idx]) { 1020 if (send_stream_[stream_idx]) {
1004 if (encoded_images_[encoder_idx]._length > 0) { 1021 if (encoded_images_[encoder_idx]._length > 0) {
1005 TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx, 1022 TRACE_COUNTER_ID1("webrtc", "EncodedFrameSize", encoder_idx,
1006 encoded_images_[encoder_idx]._length); 1023 encoded_images_[encoder_idx]._length);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 return -1; 1410 return -1;
1394 } 1411 }
1395 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) 1412 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_)
1396 != VPX_CODEC_OK) { 1413 != VPX_CODEC_OK) {
1397 return -1; 1414 return -1;
1398 } 1415 }
1399 return 0; 1416 return 0;
1400 } 1417 }
1401 1418
1402 } // namespace webrtc 1419 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/send_statistics_proxy.h » ('j') | webrtc/video/send_statistics_proxy.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698