Commit 9b99d2bd authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

VaapiVEA, V4L2VEA: Refuse temporal and spatial layer encoding

Temporal and spatial layer encoding configuration has been
refused in RtcVideoEncoder (VEAClient for webrtc).
crrev.com/c/2131444 starts to propagate the configuration to
VEA so that each VEA judges if they are supported.
As VaapiVEA and V4L2VEA support neither temporal nor
spatial layer encoding currently, this CL modified their
Initialize() to fail if such mode is requested via the Config
parameters.

Bug: 1030199
Test: HW decoder and encoder is used in appr.tc on shyvana
Bug: vea test on shyvana
Bug: media_unittests --gtest_filter=VaapiVEA* on shyvana
Change-Id: Ic5501230e1d1f82bb20901915c264d1c67691061
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132007Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758612}
parent f064e48f
...@@ -200,6 +200,10 @@ bool V4L2VideoEncodeAccelerator::Initialize(const Config& config, ...@@ -200,6 +200,10 @@ bool V4L2VideoEncodeAccelerator::Initialize(const Config& config,
TRACE_EVENT0("media,gpu", "V4L2VEA::Initialize"); TRACE_EVENT0("media,gpu", "V4L2VEA::Initialize");
VLOGF(2) << ": " << config.AsHumanReadableString(); VLOGF(2) << ": " << config.AsHumanReadableString();
if (config.HasTemporalLayer() || config.HasSpatialLayer()) {
VLOGF(1) << "Neither temporal nor spatial layer encoding is supported";
return false;
}
encoder_input_visible_rect_ = gfx::Rect(config.input_visible_size); encoder_input_visible_rect_ = gfx::Rect(config.input_visible_size);
......
...@@ -279,6 +279,10 @@ bool VaapiVideoEncodeAccelerator::Initialize(const Config& config, ...@@ -279,6 +279,10 @@ bool VaapiVideoEncodeAccelerator::Initialize(const Config& config,
DCHECK_EQ(state_, kUninitialized); DCHECK_EQ(state_, kUninitialized);
VLOGF(2) << "Initializing VAVEA, " << config.AsHumanReadableString(); VLOGF(2) << "Initializing VAVEA, " << config.AsHumanReadableString();
if (config.HasTemporalLayer() || config.HasSpatialLayer()) {
VLOGF(1) << "Neither temporal nor spatial layer encoding is supported";
return false;
}
client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
client_ = client_ptr_factory_->GetWeakPtr(); client_ = client_ptr_factory_->GetWeakPtr();
......
...@@ -89,6 +89,18 @@ std::string VideoEncodeAccelerator::Config::AsHumanReadableString() const { ...@@ -89,6 +89,18 @@ std::string VideoEncodeAccelerator::Config::AsHumanReadableString() const {
return str; return str;
} }
bool VideoEncodeAccelerator::Config::HasTemporalLayer() const {
for (const auto& sl : spatial_layers) {
if (sl.num_of_temporal_layers > 1u)
return true;
}
return false;
}
bool VideoEncodeAccelerator::Config::HasSpatialLayer() const {
return spatial_layers.size() > 1u;
}
void VideoEncodeAccelerator::Client::NotifyEncoderInfoChange( void VideoEncodeAccelerator::Client::NotifyEncoderInfoChange(
const VideoEncoderInfo& info) { const VideoEncoderInfo& info) {
// Do nothing if a client doesn't use the info. // Do nothing if a client doesn't use the info.
......
...@@ -144,6 +144,9 @@ class MEDIA_EXPORT VideoEncodeAccelerator { ...@@ -144,6 +144,9 @@ class MEDIA_EXPORT VideoEncodeAccelerator {
std::string AsHumanReadableString() const; std::string AsHumanReadableString() const;
bool HasTemporalLayer() const;
bool HasSpatialLayer() const;
// Frame format of input stream (as would be reported by // Frame format of input stream (as would be reported by
// VideoFrame::format() for frames passed to Encode()). // VideoFrame::format() for frames passed to Encode()).
VideoPixelFormat input_format; VideoPixelFormat input_format;
......
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