Commit 1e592fb9 authored by Wan-Teh Chang's avatar Wan-Teh Chang Committed by Commit Bot

Use libgav1 in cdm_video_decoder.cc and unit tests

  $ gn args out/Default
  # In the editor, add the following build argument:
  # enable_libgav1_decoder = true
  $ autoninja -C out/Default media_unittests
  $ out/Default/media_unittests
  $ out/Default/media_unittests --enable-features=Gav1VideoDecoder

Tested: 
Bug: 1026522
Change-Id: I2b033b5993b69a5e58d670434726d9e8d8b69e6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040434Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Cr-Commit-Position: refs/heads/master@{#738854}
parent 69735c62
......@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/containers/queue.h"
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/no_destructor.h"
......@@ -21,6 +22,7 @@
#include "base/task/single_thread_task_executor.h"
#include "base/threading/thread_task_runner_handle.h"
#include "media/base/decode_status.h"
#include "media/base/media_switches.h"
#include "media/base/media_util.h"
#include "media/cdm/cdm_type_conversion.h"
#include "media/cdm/library_cdm/cdm_host_proxy.h"
......@@ -44,6 +46,10 @@
#include "media/filters/ffmpeg_video_decoder.h"
#endif
#if BUILDFLAG(ENABLE_LIBGAV1_DECODER)
#include "media/filters/gav1_video_decoder.h"
#endif
namespace media {
namespace {
......@@ -304,6 +310,13 @@ std::unique_ptr<CdmVideoDecoder> CreateVideoDecoder(
video_decoder.reset(new VpxVideoDecoder());
#endif
#if BUILDFLAG(ENABLE_LIBGAV1_DECODER)
if (base::FeatureList::IsEnabled(kGav1VideoDecoder)) {
if (config.codec == cdm::kCodecAv1)
video_decoder.reset(new Gav1VideoDecoder(null_media_log.get()));
} else
#endif // BUILDFLAG(ENABLE_LIBGAV1_DECODER)
{
#if BUILDFLAG(ENABLE_DAV1D_DECODER)
if (config.codec == cdm::kCodecAv1)
video_decoder.reset(new Dav1dVideoDecoder(null_media_log.get()));
......@@ -311,6 +324,7 @@ std::unique_ptr<CdmVideoDecoder> CreateVideoDecoder(
if (config.codec == cdm::kCodecAv1)
video_decoder.reset(new AomVideoDecoder(null_media_log.get()));
#endif
}
#if BUILDFLAG(ENABLE_FFMPEG)
if (!video_decoder)
......
......@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
......@@ -48,6 +49,10 @@
#include "media/filters/vpx_video_decoder.h"
#endif
#if BUILDFLAG(ENABLE_LIBGAV1_DECODER)
#include "media/filters/gav1_video_decoder.h"
#endif
using ::testing::_;
using ::testing::AnyNumber;
using ::testing::AtLeast;
......@@ -74,12 +79,20 @@ static std::vector<std::unique_ptr<VideoDecoder>> CreateVideoDecodersForTest(
video_decoders.push_back(std::make_unique<OffloadingVpxVideoDecoder>());
#endif
#if BUILDFLAG(ENABLE_LIBGAV1_DECODER)
if (base::FeatureList::IsEnabled(kGav1VideoDecoder)) {
video_decoders.push_back(
std::make_unique<OffloadingGav1VideoDecoder>(media_log));
} else
#endif // BUILDFLAG(ENABLE_LIBGAV1_DECODER)
{
#if BUILDFLAG(ENABLE_DAV1D_DECODER)
video_decoders.push_back(
std::make_unique<OffloadingDav1dVideoDecoder>(media_log));
#elif BUILDFLAG(ENABLE_LIBAOM_DECODER)
video_decoders.push_back(std::make_unique<AomVideoDecoder>(media_log));
#endif
}
#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
video_decoders.push_back(std::make_unique<FFmpegVideoDecoder>(media_log));
......
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