Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1219)

Unified Diff: media/base/decode_capabilities.cc

Issue 2758873003: New media/base/decode_capabilities.h|cc (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/decode_capabilities.h ('k') | media/base/decode_capabilities_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/decode_capabilities.cc
diff --git a/content/renderer/media/render_media_client.cc b/media/base/decode_capabilities.cc
similarity index 56%
copy from content/renderer/media/render_media_client.cc
copy to media/base/decode_capabilities.cc
index 4343171c37d0bebfbbe4b9fcbb3d2900934d25a4..48bc2ef0f3ae0f26a17ea3331749c0770861f5a1 100644
--- a/content/renderer/media/render_media_client.cc
+++ b/media/base/decode_capabilities.cc
@@ -1,97 +1,15 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/renderer/media/render_media_client.h"
+#include "media/base/decode_capabilities.h"
#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/time/default_tick_clock.h"
-#include "content/public/common/content_client.h"
-#include "content/public/renderer/content_renderer_client.h"
+#include "base/feature_list.h"
#include "media/base/media_switches.h"
-#include "media/base/video_color_space.h"
#include "ui/display/display_switches.h"
-namespace content {
-
-void RenderMediaClient::Initialize() {
- GetInstance();
-}
-
-RenderMediaClient::RenderMediaClient()
- : has_updated_(false),
- is_update_needed_(true),
- tick_clock_(new base::DefaultTickClock()) {
- media::SetMediaClient(this);
-}
-
-RenderMediaClient::~RenderMediaClient() {
-}
-
-void RenderMediaClient::AddKeySystemsInfoForUMA(
- std::vector<media::KeySystemInfoForUMA>* key_systems_info_for_uma) {
- DVLOG(2) << __func__;
-#if defined(WIDEVINE_CDM_AVAILABLE)
- key_systems_info_for_uma->push_back(media::KeySystemInfoForUMA(
- kWidevineKeySystem, kWidevineKeySystemNameForUMA));
-#endif // WIDEVINE_CDM_AVAILABLE
-}
-
-bool RenderMediaClient::IsKeySystemsUpdateNeeded() {
- DVLOG(2) << __func__;
- DCHECK(thread_checker_.CalledOnValidThread());
-
- // Always needs update if we have never updated, regardless the
- // |last_update_time_ticks_|'s initial value.
- if (!has_updated_) {
- DCHECK(is_update_needed_);
- return true;
- }
-
- if (!is_update_needed_)
- return false;
-
- // The update could be expensive. For example, it could involve a sync IPC to
- // the browser process. Use a minimum update interval to avoid unnecessarily
- // frequent update.
- static const int kMinUpdateIntervalInMilliseconds = 1000;
- if ((tick_clock_->NowTicks() - last_update_time_ticks_).InMilliseconds() <
- kMinUpdateIntervalInMilliseconds) {
- return false;
- }
-
- return true;
-}
-
-void RenderMediaClient::AddSupportedKeySystems(
- std::vector<std::unique_ptr<media::KeySystemProperties>>*
- key_systems_properties) {
- DVLOG(2) << __func__;
- DCHECK(thread_checker_.CalledOnValidThread());
-
- GetContentClient()->renderer()->AddSupportedKeySystems(
- key_systems_properties);
-
- has_updated_ = true;
- last_update_time_ticks_ = tick_clock_->NowTicks();
-
- // Check whether all potentially supported key systems are supported. If so,
- // no need to update again.
-#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
- for (const auto& properties : *key_systems_properties) {
- if (properties->GetKeySystemName() == kWidevineKeySystem)
- is_update_needed_ = false;
- }
-#else
- is_update_needed_ = false;
-#endif
-}
-
-void RenderMediaClient::RecordRapporURL(const std::string& metric,
- const GURL& url) {
- GetContentClient()->renderer()->RecordRapporURL(metric, url);
-}
+namespace media {
bool IsColorSpaceSupported(const media::VideoColorSpace& color_space) {
bool color_management =
@@ -184,9 +102,9 @@ bool IsColorSpaceSupported(const media::VideoColorSpace& color_space) {
return true;
}
-bool RenderMediaClient::IsSupportedVideoConfig(
- const media::VideoConfig& config) {
- // TODO(chcunningham): Query decoders for codec profile support.
+// TODO(chcunningham): Query decoders for codec profile support. Add platform
+// specific logic for Android (move from MimeUtilIntenral).
+bool IsSupportedVideoConfig(const VideoConfig& config) {
switch (config.codec) {
case media::kCodecVP9:
// Color management required for HDR to not look terrible.
@@ -210,15 +128,4 @@ bool RenderMediaClient::IsSupportedVideoConfig(
return false;
}
-void RenderMediaClient::SetTickClockForTesting(
- std::unique_ptr<base::TickClock> tick_clock) {
- tick_clock_.swap(tick_clock);
-}
-
-// static
-RenderMediaClient* RenderMediaClient::GetInstance() {
- static RenderMediaClient* client = new RenderMediaClient();
- return client;
-}
-
-} // namespace content
+} // namespace media
« no previous file with comments | « media/base/decode_capabilities.h ('k') | media/base/decode_capabilities_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698