Commit 8be75a97 authored by Zhaoliang Ma's avatar Zhaoliang Ma Committed by Commit Bot

[webcodecs] Set VEA default bitrate based on image size

As mentioned, this CL set the default bitrate based on image size
instead of setting a fixed value.

Bug: None
Change-Id: I694f71f5fef64165ef15f4f8d07012485297e2e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389261
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarEugene Zemtsov <eugene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805025}
parent 00551fe9
......@@ -20,6 +20,11 @@
namespace media {
namespace {
// HW encoders expect a nonzero bitrate, so |kVEADefaultBitratePerPixel| is used
// to estimate bits per second for ~30 fps with ~1/16 compression rate.
constexpr int kVEADefaultBitratePerPixel = 2;
Status SetUpVeaConfig(VideoCodecProfile profile,
const VideoEncoder::Options& opts,
VideoEncodeAccelerator::Config* config) {
......@@ -29,9 +34,11 @@ Status SetUpVeaConfig(VideoCodecProfile profile,
*config = VideoEncodeAccelerator::Config(
PIXEL_FORMAT_I420, gfx::Size(opts.width, opts.height), profile,
opts.bitrate.value_or(1000000));
opts.bitrate.value_or(opts.width * opts.height *
kVEADefaultBitratePerPixel));
return Status();
}
} // namespace
class VideoEncodeAcceleratorAdapter::SharedMemoryPool
......
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