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

Side by Side Diff: content/renderer/media/video_track_recorder.cc

Issue 1925443002: Fix MediaRecorder bitrate configuration bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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 | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/video_track_recorder.h" 5 #include "content/renderer/media/video_track_recorder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 const vpx_codec_iface_t* interface = 273 const vpx_codec_iface_t* interface =
274 use_vp9_ ? vpx_codec_vp9_cx() : vpx_codec_vp8_cx(); 274 use_vp9_ ? vpx_codec_vp9_cx() : vpx_codec_vp8_cx();
275 vpx_codec_err_t result = 275 vpx_codec_err_t result =
276 vpx_codec_enc_config_default(interface, &codec_config_, 0 /* reserved */); 276 vpx_codec_enc_config_default(interface, &codec_config_, 0 /* reserved */);
277 DCHECK_EQ(VPX_CODEC_OK, result); 277 DCHECK_EQ(VPX_CODEC_OK, result);
278 278
279 DCHECK_EQ(320u, codec_config_.g_w); 279 DCHECK_EQ(320u, codec_config_.g_w);
280 DCHECK_EQ(240u, codec_config_.g_h); 280 DCHECK_EQ(240u, codec_config_.g_h);
281 DCHECK_EQ(256u, codec_config_.rc_target_bitrate); 281 DCHECK_EQ(256u, codec_config_.rc_target_bitrate);
282 // Use the selected bitrate or adjust default bit rate to account for the 282 // Use the selected bitrate or adjust default bit rate to account for the
283 // actual size. 283 // actual size. Note: |rc_target_bitrate| units are kbit per second.
284 if (bits_per_second_ > 0) { 284 if (bits_per_second_ > 0) {
285 codec_config_.rc_target_bitrate = bits_per_second_; 285 codec_config_.rc_target_bitrate = bits_per_second_ / 1000;
286 } else { 286 } else {
287 codec_config_.rc_target_bitrate = size.GetArea() * 287 codec_config_.rc_target_bitrate = size.GetArea() *
288 codec_config_.rc_target_bitrate / 288 codec_config_.rc_target_bitrate /
289 codec_config_.g_w / codec_config_.g_h; 289 codec_config_.g_w / codec_config_.g_h;
290 } 290 }
291 // Both VP8/VP9 configuration should be Variable BitRate by default. 291 // Both VP8/VP9 configuration should be Variable BitRate by default.
292 DCHECK_EQ(VPX_VBR, codec_config_.rc_end_usage); 292 DCHECK_EQ(VPX_VBR, codec_config_.rc_end_usage);
293 if (use_vp9_) { 293 if (use_vp9_) {
294 // Number of frames to consume before producing output. 294 // Number of frames to consume before producing output.
295 codec_config_.g_lag_in_frames = 0; 295 codec_config_.g_lag_in_frames = 0;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 encoder_->set_paused(false); 417 encoder_->set_paused(false);
418 } 418 }
419 419
420 void VideoTrackRecorder::OnVideoFrameForTesting( 420 void VideoTrackRecorder::OnVideoFrameForTesting(
421 const scoped_refptr<media::VideoFrame>& frame, 421 const scoped_refptr<media::VideoFrame>& frame,
422 base::TimeTicks timestamp) { 422 base::TimeTicks timestamp) {
423 encoder_->StartFrameEncode(frame, timestamp); 423 encoder_->StartFrameEncode(frame, timestamp);
424 } 424 }
425 425
426 } // namespace content 426 } // namespace content
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698