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

Unified Diff: content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc

Issue 1566533003: V4L2(S)VDA: Check if device handles profile for supported fourccs on init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc b/content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc
index 468c5bd5a966c70010b9bf7dfe62276ab37316ff..4c3b724daa5bb5e6b1bc7d8bfeaf332023054bd7 100644
--- a/content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc
+++ b/content/common/gpu/media/v4l2_slice_video_decode_accelerator.cc
@@ -55,6 +55,11 @@
namespace content {
+// static
+const uint32_t V4L2SliceVideoDecodeAccelerator::supported_input_fourccs_[] = {
+ V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME,
+};
+
class V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface
: public base::RefCounted<V4L2DecodeSurface> {
public:
@@ -436,13 +441,20 @@ void V4L2SliceVideoDecodeAccelerator::NotifyError(Error error) {
bool V4L2SliceVideoDecodeAccelerator::Initialize(const Config& config,
Client* client) {
DVLOGF(3) << "profile: " << config.profile;
+ DCHECK(child_task_runner_->BelongsToCurrentThread());
+ DCHECK_EQ(state_, kUninitialized);
+
if (config.is_encrypted) {
NOTREACHED() << "Encrypted streams are not supported for this VDA";
return false;
}
- DCHECK(child_task_runner_->BelongsToCurrentThread());
- DCHECK_EQ(state_, kUninitialized);
+ if (!device_->SupportsDecodeProfileForV4L2PixelFormats(
+ config.profile, arraysize(supported_input_fourccs_),
+ supported_input_fourccs_)) {
+ DVLOGF(1) << "unsupported profile " << config.profile;
+ return false;
+ }
client_ptr_factory_.reset(
new base::WeakPtrFactory<VideoDecodeAccelerator::Client>(client));
@@ -459,7 +471,7 @@ bool V4L2SliceVideoDecodeAccelerator::Initialize(const Config& config,
vp8_accelerator_.reset(new V4L2VP8Accelerator(this));
decoder_.reset(new VP8Decoder(vp8_accelerator_.get()));
} else {
- DLOG(ERROR) << "Unsupported profile " << video_profile_;
+ NOTREACHED() << "Unsupported profile " << video_profile_;
return false;
}
@@ -2543,10 +2555,8 @@ V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() {
if (!device)
return SupportedProfiles();
- const uint32_t supported_formats[] = {
- V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME};
- return device->GetSupportedDecodeProfiles(arraysize(supported_formats),
- supported_formats);
+ return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_),
+ supported_input_fourccs_);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698