Commit 185c9436 authored by emircan's avatar emircan Committed by Commit bot

Specify a default bitrate for VEAEncoder

This CL adds a non-zero default bitrate for VEAEncoder. When given 0 bitrate,
Media Foundation H264 HW encoder does not output any results.

BUG=676421
TEST= Tested https://rawgit.com/Miguelao/demos/master/mediarecorder.html
H264 on Mac and Win.

Review-Url: https://codereview.chromium.org/2611843002
Cr-Commit-Position: refs/heads/master@{#441427}
parent fd81dc85
......@@ -53,6 +53,11 @@ namespace content {
namespace {
// HW encoders expect a nonzero bitrate, so |kVEADefaultBitratePerPixel| is used
// to estimate bits per second for ~30 fps with ~1/16 compression rate.
const int kVEADefaultBitratePerPixel = 2;
// Number of output buffers used to copy the encoded data coming from HW
// encoders.
const int kVEAEncoderOutputBufferCount = 4;
static struct {
......@@ -509,7 +514,8 @@ VEAEncoder::VEAEncoder(
media::VideoCodecProfile codec,
const gfx::Size& size)
: Encoder(on_encoded_video_callback,
bits_per_second,
bits_per_second > 0 ? bits_per_second
: size.GetArea() * kVEADefaultBitratePerPixel,
RenderThreadImpl::current()->GetGpuFactories()->GetTaskRunner()),
gpu_factories_(RenderThreadImpl::current()->GetGpuFactories()),
codec_(codec),
......@@ -692,6 +698,7 @@ void VEAEncoder::ConfigureEncoderOnEncodingTaskRunner(const gfx::Size& size) {
DVLOG(3) << __func__;
DCHECK(encoding_task_runner_->BelongsToCurrentThread());
DCHECK(gpu_factories_->GetTaskRunner()->BelongsToCurrentThread());
DCHECK_GT(bits_per_second_, 0);
input_size_ = size;
video_encoder_ = gpu_factories_->CreateVideoEncodeAccelerator();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment