Commit 8f921e30 authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Chromium LUCI CQ

vaapi: Fix H264 full sample decryption

There's 2 things that were wrong. We were not initializing the
VAEncryptionParameters structure we were using, causing bad values to be
present.  We also had a regression error where we then were resubmitting
the VAEncryptionParameters during decode of full sample content. This
fixes both of those.

BUG=b:178039332
TEST=Full sample H264 protected content plays on volteer

Change-Id: I47b82a5f022292290151178cc26266c55b9dff42
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2643536
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jao-ke Chin-Lee <jchinlee@chromium.org>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarJao-ke Chin-Lee <jchinlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845806}
parent 8fd6211f
...@@ -89,6 +89,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitFrameMetadata( ...@@ -89,6 +89,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitFrameMetadata(
VAPictureParameterBufferH264 pic_param; VAPictureParameterBufferH264 pic_param;
memset(&pic_param, 0, sizeof(pic_param)); memset(&pic_param, 0, sizeof(pic_param));
memset(&crypto_params_, 0, sizeof(crypto_params_)); memset(&crypto_params_, 0, sizeof(crypto_params_));
full_sample_ = false;
#define FROM_SPS_TO_PP(a) pic_param.a = sps->a #define FROM_SPS_TO_PP(a) pic_param.a = sps->a
#define FROM_SPS_TO_PP2(a, b) pic_param.b = sps->a #define FROM_SPS_TO_PP2(a, b) pic_param.b = sps->a
...@@ -208,7 +209,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::ParseEncryptedSliceHeader( ...@@ -208,7 +209,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::ParseEncryptedSliceHeader(
// extract the slice header parameters of interest and return them to the // extract the slice header parameters of interest and return them to the
// caller. // caller.
VAEncryptionParameters crypto_params; VAEncryptionParameters crypto_params = {};
// Don't use the VAEncryptionSegmentInfo vector in the class since we do not // Don't use the VAEncryptionSegmentInfo vector in the class since we do not
// need to hold this data across calls. // need to hold this data across calls.
std::vector<VAEncryptionSegmentInfo> segment_info; std::vector<VAEncryptionSegmentInfo> segment_info;
...@@ -358,6 +359,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice( ...@@ -358,6 +359,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
// We do not need to submit all the slice data, instead we just submit the // We do not need to submit all the slice data, instead we just submit the
// index for what was already sent for parsing. The HW decoder already has // index for what was already sent for parsing. The HW decoder already has
// the full slice data from when we decrypted the header. // the full slice data from when we decrypted the header.
full_sample_ = true;
VACencStatusParameters cenc_status = {}; VACencStatusParameters cenc_status = {};
cenc_status.status_report_index_feedback = slice_hdr->full_sample_index; cenc_status.status_report_index_feedback = slice_hdr->full_sample_index;
return vaapi_wrapper_->SubmitBuffer(VACencStatusParameterBufferType, return vaapi_wrapper_->SubmitBuffer(VACencStatusParameterBufferType,
...@@ -479,7 +481,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitDecode( ...@@ -479,7 +481,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitDecode(
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT0("media,gpu", "H264VaapiVideoDecoderDelegate::SubmitDecode"); TRACE_EVENT0("media,gpu", "H264VaapiVideoDecoderDelegate::SubmitDecode");
if (IsEncryptedSession() && if (IsEncryptedSession() && !full_sample_ &&
!vaapi_wrapper_->SubmitBuffer(VAEncryptionParameterBufferType, !vaapi_wrapper_->SubmitBuffer(VAEncryptionParameterBufferType,
sizeof(crypto_params_), &crypto_params_)) { sizeof(crypto_params_), &crypto_params_)) {
return DecodeStatus::kFail; return DecodeStatus::kFail;
......
...@@ -77,6 +77,9 @@ class H264VaapiVideoDecoderDelegate : public H264Decoder::H264Accelerator, ...@@ -77,6 +77,9 @@ class H264VaapiVideoDecoderDelegate : public H264Decoder::H264Accelerator,
// the encryption details across all the slices. // the encryption details across all the slices.
VAEncryptionParameters crypto_params_; VAEncryptionParameters crypto_params_;
// We need to set this so we don't resubmit crypto params on decode.
bool full_sample_;
DISALLOW_COPY_AND_ASSIGN(H264VaapiVideoDecoderDelegate); DISALLOW_COPY_AND_ASSIGN(H264VaapiVideoDecoderDelegate);
}; };
......
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