Update vaapi_wrapper.cc

This commit is contained in:
Alexander David Frick 2021-10-26 08:52:46 -05:00 committed by GitHub
parent 22a871e8f0
commit ddb62b3694
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3028,27 +3028,12 @@ bool VaapiWrapper::CreateSurfaces(
va_surfaces->resize(num_surfaces);
VASurfaceAttrib attribute{};
VASurfaceAttrib attribute;
memset(&attribute, 0, sizeof(attribute));
if (GetImplementationType() != VAImplementation::kNVIDIAVDPAU) {
// Nvidia's VAAPI-VDPAU driver doesn't support this attribute
attribute.type = VASurfaceAttribUsageHint;
attribute.flags = VA_SURFACE_ATTRIB_SETTABLE;
attribute.value.type = VAGenericValueTypeInteger;
switch (usage_hint) {
case SurfaceUsageHint::kVideoDecoder:
attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER;
break;
case SurfaceUsageHint::kVideoEncoder:
attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER;
break;
case SurfaceUsageHint::kVideoProcessWrite:
attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
break;
case SurfaceUsageHint::kGeneric:
attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC;
break;
}
attribute.value.value.i = 0;
for (SurfaceUsageHint usage_hint : usage_hints)
attribute.value.value.i |= static_cast<int32_t>(usage_hint);
static_assert(std::is_same<decltype(attribute.value.value.i), int32_t>::value,