Commit 44b04cd6 authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Set PROTECTED_VIDEO meta data in CdmAdapter

If the current video stream is encrypted, set PROTECTED_VIDEO in the
decoded video frame.

Notes:
- clear leads in an encrypted video stream also have PROTECTED_VIDEO set
- For clear stream, even though we are using the CDM to decode it,
  PROTECTED_VIDEO will NOT be set

Bug: 849464
Change-Id: Iae3257aaa122af8073f815278d8b65b55946f3f3
Reviewed-on: https://chromium-review.googlesource.com/c/1337486
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Reviewed-by: default avatarMaggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609851}
parent fe8d94c2
...@@ -528,6 +528,7 @@ void CdmAdapter::InitializeVideoDecoder(const VideoDecoderConfig& config, ...@@ -528,6 +528,7 @@ void CdmAdapter::InitializeVideoDecoder(const VideoDecoderConfig& config,
} }
pixel_aspect_ratio_ = config.GetPixelAspectRatio(); pixel_aspect_ratio_ = config.GetPixelAspectRatio();
is_video_encrypted_ = config.is_encrypted();
if (status == cdm::kDeferredInitialization) { if (status == cdm::kDeferredInitialization) {
DVLOG(1) << "Deferred initialization in " << __func__; DVLOG(1) << "Deferred initialization in " << __func__;
...@@ -608,6 +609,11 @@ void CdmAdapter::DecryptAndDecodeVideo(scoped_refptr<DecoderBuffer> encrypted, ...@@ -608,6 +609,11 @@ void CdmAdapter::DecryptAndDecodeVideo(scoped_refptr<DecoderBuffer> encrypted,
return; return;
} }
if (is_video_encrypted_) {
decoded_frame->metadata()->SetBoolean(VideoFrameMetadata::PROTECTED_VIDEO,
true);
}
video_decode_cb.Run(Decryptor::kSuccess, decoded_frame); video_decode_cb.Run(Decryptor::kSuccess, decoded_frame);
} }
......
...@@ -252,6 +252,9 @@ class MEDIA_EXPORT CdmAdapter : public ContentDecryptionModule, ...@@ -252,6 +252,9 @@ class MEDIA_EXPORT CdmAdapter : public ContentDecryptionModule,
// Keep track of aspect ratio from the latest configuration. // Keep track of aspect ratio from the latest configuration.
double pixel_aspect_ratio_ = 0.0; double pixel_aspect_ratio_ = 0.0;
// Whether the current video config is encrypted.
bool is_video_encrypted_ = false;
// Tracks whether an output protection query and a positive query result (no // Tracks whether an output protection query and a positive query result (no
// unprotected external link) have been reported to UMA. // unprotected external link) have been reported to UMA.
bool uma_for_output_protection_query_reported_ = false; bool uma_for_output_protection_query_reported_ = false;
......
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