Skip to content

Commit

Permalink
Fix MediaRecorder bitrate configuration bug
Browse files Browse the repository at this point in the history
The MediaRecorder API specifies that bitrates be communicated in bits
per second, which is correctly plumbed through Chrome.  However, VPx
encoders expect its arguments to be specified in kilobits per second.
This resulted in specifying any bitrate via the javascript API to be
off by a thousand, resulting in enormous files.  Change it so we
convert bits -> kilobits by dividing by 1000
BUG=605750

R=mcasas@chromium.org

Review URL: https://codereview.chromium.org/1913233002

Cr-Commit-Position: refs/heads/master@{#389411}
  • Loading branch information
jnoring-hv authored and Commit bot committed Apr 25, 2016
1 parent fe8421b commit 0a58e71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ Jay Soffian <jaysoffian@gmail.com>
Jeado Ko <haibane84@gmail.com>
Jeongeun Kim <je_julie.kim@samsung.com>
Jeongmin Kim <kimwjdalsl@gmail.com>
Jeremy Noring <jnoring@hirevue.com>
Jeremy Spiegel <jeremysspiegel@gmail.com>
Jesper Storm Bache <jsbache@gmail.com>
Jesse Miller <jesse@jmiller.biz>
Expand Down
4 changes: 2 additions & 2 deletions content/renderer/media/video_track_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ void VpxEncoder::ConfigureEncoderOnEncodingThread(const gfx::Size& size) {
DCHECK_EQ(240u, codec_config_.g_h);
DCHECK_EQ(256u, codec_config_.rc_target_bitrate);
// Use the selected bitrate or adjust default bit rate to account for the
// actual size.
// actual size. Note: |rc_target_bitrate| units are kbit per second.
if (bits_per_second_ > 0) {
codec_config_.rc_target_bitrate = bits_per_second_;
codec_config_.rc_target_bitrate = bits_per_second_ / 1000;
} else {
codec_config_.rc_target_bitrate = size.GetArea() *
codec_config_.rc_target_bitrate /
Expand Down

0 comments on commit 0a58e71

Please sign in to comment.