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

Unified Diff: chrome/browser/media/encrypted_media_message_filter_android.cc

Issue 253593002: Componentize EncryptedMediaMessageFilter and rename it CdmMessageFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the empty library problem in macos build. Created 6 years, 7 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 | « chrome/browser/media/encrypted_media_message_filter_android.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/encrypted_media_message_filter_android.cc
diff --git a/chrome/browser/media/encrypted_media_message_filter_android.cc b/chrome/browser/media/encrypted_media_message_filter_android.cc
deleted file mode 100644
index e16b0e9b948cc3da2691d52ae38e9a4b3e79ed56..0000000000000000000000000000000000000000
--- a/chrome/browser/media/encrypted_media_message_filter_android.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2013 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 "chrome/browser/media/encrypted_media_message_filter_android.h"
-
-#include <string>
-
-#include "chrome/common/encrypted_media_messages_android.h"
-#include "ipc/ipc_message_macros.h"
-#include "media/base/android/media_codec_bridge.h"
-#include "media/base/android/media_drm_bridge.h"
-
-using content::BrowserThread;
-using content::SupportedCodecs;
-using media::MediaCodecBridge;
-using media::MediaDrmBridge;
-
-namespace chrome {
-
-const size_t kMaxKeySystemLength = 256;
-
-enum CodecType {
- CODEC_AUDIO,
- CODEC_VIDEO
-};
-
-struct CodecInfo {
- SupportedCodecs codec;
- CodecType codec_type;
- const char* codec_name;
- const char* container_mime_type;
-};
-
-const CodecInfo kCodecsToQuery[] = {
- {content::EME_CODEC_WEBM_VORBIS, CODEC_AUDIO, "vorbis", "video/webm"},
- {content::EME_CODEC_WEBM_VP8, CODEC_VIDEO, "vp8", "video/webm"},
- {content::EME_CODEC_WEBM_VP9, CODEC_VIDEO, "vp9", "video/webm"},
-#if defined(USE_PROPRIETARY_CODECS)
- {content::EME_CODEC_MP4_AAC, CODEC_AUDIO, "mp4a", "video/mp4"},
- {content::EME_CODEC_MP4_AVC1, CODEC_VIDEO, "avc1", "video/mp4"}
-#endif // defined(USE_PROPRIETARY_CODECS)
-};
-
-static SupportedCodecs GetSupportedCodecs(
- const SupportedKeySystemRequest& request,
- bool video_must_be_compositable) {
- const std::string& key_system = request.key_system;
- SupportedCodecs supported_codecs = content::EME_CODEC_NONE;
-
- for (size_t i = 0; i < arraysize(kCodecsToQuery); ++i) {
- const CodecInfo& info = kCodecsToQuery[i];
- // TODO(qinmin): Remove the composition logic when secure contents can be
- // composited.
- bool is_secure = (info.codec_type == CODEC_VIDEO)
- ? (!video_must_be_compositable) : false;
- if ((request.codecs & info.codec) &&
- MediaDrmBridge::IsKeySystemSupportedWithType(
- key_system, info.container_mime_type) &&
- MediaCodecBridge::CanDecode(info.codec_name, is_secure)) {
- supported_codecs |= info.codec;
- }
- }
-
- return supported_codecs;
-}
-
-EncryptedMediaMessageFilterAndroid::EncryptedMediaMessageFilterAndroid()
- : BrowserMessageFilter(EncryptedMediaMsgStart) {}
-
-EncryptedMediaMessageFilterAndroid::~EncryptedMediaMessageFilterAndroid() {}
-
-bool EncryptedMediaMessageFilterAndroid::OnMessageReceived(
- const IPC::Message& message, bool* message_was_ok) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_EX(
- EncryptedMediaMessageFilterAndroid, message, *message_was_ok)
- IPC_MESSAGE_HANDLER(ChromeViewHostMsg_GetSupportedKeySystems,
- OnGetSupportedKeySystems)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP_EX()
- return handled;
-}
-
-void EncryptedMediaMessageFilterAndroid::OverrideThreadForMessage(
- const IPC::Message& message, BrowserThread::ID* thread) {
- // Move the IPC handling to FILE thread as it is not very cheap.
- if (message.type() == ChromeViewHostMsg_GetSupportedKeySystems::ID)
- *thread = BrowserThread::FILE;
-}
-
-void EncryptedMediaMessageFilterAndroid::OnGetSupportedKeySystems(
- const SupportedKeySystemRequest& request,
- SupportedKeySystemResponse* response) {
- if (!response) {
- NOTREACHED() << "NULL response pointer provided.";
- return;
- }
-
- if (request.key_system.size() > kMaxKeySystemLength) {
- NOTREACHED() << "Invalid key system: " << request.key_system;
- return;
- }
-
- if (!MediaDrmBridge::IsKeySystemSupported(request.key_system))
- return;
-
- DCHECK(request.codecs & content::EME_CODEC_ALL) << "unrecognized codec";
- response->key_system = request.key_system;
- // TODO(qinmin): check composition is supported or not.
- response->compositing_codecs = GetSupportedCodecs(request, true);
- response->non_compositing_codecs = GetSupportedCodecs(request, false);
-}
-
-} // namespace chrome
« no previous file with comments | « chrome/browser/media/encrypted_media_message_filter_android.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698