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

Side by Side Diff: webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc

Issue 2309743002: Move the QP scaling thresholds to the relevant encoders (Closed)
Patch Set: Remove redundant call 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 SEncParamExt encoder_params = CreateEncoderParams(); 207 SEncParamExt encoder_params = CreateEncoderParams();
208 // Initialize. 208 // Initialize.
209 if (openh264_encoder_->InitializeExt(&encoder_params) != 0) { 209 if (openh264_encoder_->InitializeExt(&encoder_params) != 0) {
210 LOG(LS_ERROR) << "Failed to initialize OpenH264 encoder"; 210 LOG(LS_ERROR) << "Failed to initialize OpenH264 encoder";
211 Release(); 211 Release();
212 ReportError(); 212 ReportError();
213 return WEBRTC_VIDEO_CODEC_ERROR; 213 return WEBRTC_VIDEO_CODEC_ERROR;
214 } 214 }
215 // TODO(pbos): Base init params on these values before submitting. 215 // TODO(pbos): Base init params on these values before submitting.
216 quality_scaler_.Init(QualityScaler::kLowH264QpThreshold, 216 quality_scaler_.Init(codec_settings_.codecType, codec_settings_.startBitrate,
217 QualityScaler::kBadH264QpThreshold, 217 codec_settings_.width, codec_settings_.height,
218 codec_settings_.startBitrate, codec_settings_.width, 218 codec_settings_.maxFramerate);
219 codec_settings_.height, codec_settings_.maxFramerate);
220 int video_format = EVideoFormatType::videoFormatI420; 219 int video_format = EVideoFormatType::videoFormatI420;
221 openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT, 220 openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT,
222 &video_format); 221 &video_format);
223 222
224 // Initialize encoded image. Default buffer size: size of unencoded data. 223 // Initialize encoded image. Default buffer size: size of unencoded data.
225 encoded_image_._size = CalcBufferSize( 224 encoded_image_._size = CalcBufferSize(
226 kI420, codec_settings_.width, codec_settings_.height); 225 kI420, codec_settings_.width, codec_settings_.height);
227 encoded_image_._buffer = new uint8_t[encoded_image_._size]; 226 encoded_image_._buffer = new uint8_t[encoded_image_._size];
228 encoded_image_buffer_.reset(encoded_image_._buffer); 227 encoded_image_buffer_.reset(encoded_image_._buffer);
229 encoded_image_._completeFrame = true; 228 encoded_image_._completeFrame = true;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 469
471 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { 470 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) {
472 return WEBRTC_VIDEO_CODEC_OK; 471 return WEBRTC_VIDEO_CODEC_OK;
473 } 472 }
474 473
475 void H264EncoderImpl::OnDroppedFrame() { 474 void H264EncoderImpl::OnDroppedFrame() {
476 quality_scaler_.ReportDroppedFrame(); 475 quality_scaler_.ReportDroppedFrame();
477 } 476 }
478 477
479 } // namespace webrtc 478 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698