Commit d9a54c47 authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Enable LibvpxCdmVideoDecoder in ClearKeyCdm

Previously LibvpxCdmVideoDecoder was disabled so we always do
decrypt-only for VP8 and VP9 (VPX). This CL reenable it to provide test
coverage on VPX decrypt-and-decode path.

Bug: 846064
Test: This CL improves test coverage on EncryptedMediaTest.
Change-Id: I48d2c1b52ffd37ab42c57355f4a0df4c16239f0d
Reviewed-on: https://chromium-review.googlesource.com/1069999Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561288}
parent 9dfefe12
......@@ -50,6 +50,15 @@ loadable_module("clear_key_cdm") {
defines += [ "CLEAR_KEY_CDM_USE_FFMPEG_DECODER" ]
deps += [ "//third_party/ffmpeg" ]
}
if (media_use_libvpx) {
sources += [
"libvpx_cdm_video_decoder.cc",
"libvpx_cdm_video_decoder.h",
]
defines += [ "CLEAR_KEY_CDM_USE_LIBVPX_DECODER" ]
deps += [ "//third_party/libvpx" ]
}
}
source_set("clear_key_cdm_proxy") {
......
......@@ -37,7 +37,6 @@
#include "base/path_service.h"
#include "media/base/media.h"
#include "media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.h"
#include "media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_video_decoder.h"
#if !defined COMPONENT_BUILD
static base::AtExitManager g_at_exit_manager;
......
......@@ -25,7 +25,8 @@ LibvpxCdmVideoDecoder::~LibvpxCdmVideoDecoder() {
Deinitialize();
}
bool LibvpxCdmVideoDecoder::Initialize(const cdm::VideoDecoderConfig& config) {
bool LibvpxCdmVideoDecoder::Initialize(
const cdm::VideoDecoderConfig_2& config) {
DVLOG(1) << "Initialize()";
if (!IsValidOutputConfig(config.format, config.coded_size)) {
......@@ -44,8 +45,10 @@ bool LibvpxCdmVideoDecoder::Initialize(const cdm::VideoDecoderConfig& config) {
vpx_config.h = config.coded_size.height;
vpx_config.threads = kDecodeThreads;
vpx_codec_err_t status =
vpx_codec_dec_init(vpx_codec_, vpx_codec_vp8_dx(), &vpx_config, 0);
vpx_codec_err_t status = vpx_codec_dec_init(
vpx_codec_,
config.codec == cdm::kCodecVp9 ? vpx_codec_vp9_dx() : vpx_codec_vp8_dx(),
&vpx_config, 0);
if (status != VPX_CODEC_OK) {
LOG(ERROR) << "InitializeLibvpx(): vpx_codec_dec_init failed, ret="
<< status;
......@@ -87,7 +90,7 @@ cdm::Status LibvpxCdmVideoDecoder::DecodeFrame(const uint8_t* compressed_frame,
int32_t compressed_frame_size,
int64_t timestamp,
cdm::VideoFrame* decoded_frame) {
DVLOG(1) << "DecodeFrame()";
DVLOG(3) << __func__ << ": frame size = " << compressed_frame_size;
DCHECK(decoded_frame);
// Pass |compressed_frame| to libvpx.
......
......@@ -25,7 +25,7 @@ class LibvpxCdmVideoDecoder : public CdmVideoDecoder {
~LibvpxCdmVideoDecoder() override;
// CdmVideoDecoder implementation.
bool Initialize(const cdm::VideoDecoderConfig& config) override;
bool Initialize(const cdm::VideoDecoderConfig_2& config) override;
void Deinitialize() override;
void Reset() override;
cdm::Status DecodeFrame(const uint8_t* compressed_frame,
......
......@@ -158,6 +158,7 @@ void VpxVideoDecoder::Initialize(
void VpxVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
const DecodeCB& decode_cb) {
DVLOG(3) << __func__ << ": " << buffer->AsHumanReadableString();
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(buffer);
DCHECK(!decode_cb.is_null());
......
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