Skip to content

Commit

Permalink
Encrypted Media: Separate CDM IPC messages from MediaPlayer messages.
Browse files Browse the repository at this point in the history
TBR=cevans@chromium.org
BUG=315312

Review URL: https://codereview.chromium.org/176263002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253970 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
xhwang@chromium.org committed Feb 27, 2014
1 parent 858ceda commit 33fdddf
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "content/browser/media/android/media_resource_getter_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_view_android.h"
#include "content/common/media/cdm_messages.h"
#include "content/common/media/media_player_messages_android.h"
#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/android/external_video_surface_container.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "base/memory/scoped_vector.h"
#include "base/time/time.h"
#include "content/browser/android/content_video_view.h"
#include "content/common/media/cdm_messages_enums.h"
#include "content/common/media/media_player_messages_enums_android.h"
#include "content/public/browser/web_contents_observer.h"
#include "media/base/android/media_player_android.h"
Expand Down
8 changes: 5 additions & 3 deletions content/common/content_message_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
#include "content/common/java_bridge_messages.h"
#include "content/common/media/audio_messages.h"
#include "content/common/media/midi_messages.h"
#if defined(OS_ANDROID)
#include "content/common/media/media_player_messages_android.h"
#endif
#include "content/common/media/media_stream_messages.h"
#include "content/common/media/peer_connection_tracker_messages.h"
#include "content/common/media/video_capture_messages.h"
Expand All @@ -58,3 +55,8 @@
#include "content/common/view_messages.h"
#include "content/common/websocket_messages.h"
#include "content/common/worker_messages.h"

#if defined(OS_ANDROID)
#include "content/common/media/cdm_messages.h"
#include "content/common/media/media_player_messages_android.h"
#endif // defined(OS_ANDROID)
71 changes: 71 additions & 0 deletions content/common/media/cdm_messages.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright 2014 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.

// IPC messages for content decryption module (CDM) implementation.
// Multiply-included message file, hence no include guard.

#include <string>
#include <vector>

#include "base/basictypes.h"
#include "content/common/content_export.h"
#include "content/common/media/cdm_messages_enums.h"
#include "ipc/ipc_message_macros.h"
#include "media/base/media_keys.h"
#include "url/gurl.h"

#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
#define IPC_MESSAGE_START CdmMsgStart

IPC_ENUM_TRAITS(media::MediaKeys::KeyError)
IPC_ENUM_TRAITS(CdmHostMsg_CreateSession_Type)

IPC_MESSAGE_ROUTED3(CdmHostMsg_InitializeCDM,
int /* media_keys_id */,
std::vector<uint8> /* uuid */,
GURL /* frame url */)

IPC_MESSAGE_ROUTED4(CdmHostMsg_CreateSession,
int /* media_keys_id */,
uint32_t /* session_id */,
CdmHostMsg_CreateSession_Type /* type */,
std::vector<uint8> /* init_data */)

IPC_MESSAGE_ROUTED3(CdmHostMsg_UpdateSession,
int /* media_keys_id */,
uint32_t /* session_id */,
std::vector<uint8> /* response */)

IPC_MESSAGE_ROUTED2(CdmHostMsg_ReleaseSession,
int /* media_keys_id */,
uint32_t /* session_id */)

IPC_MESSAGE_ROUTED1(CdmHostMsg_DestroyCdm,
int /* media_keys_id */)

IPC_MESSAGE_ROUTED3(CdmMsg_SessionCreated,
int /* media_keys_id */,
uint32_t /* session_id */,
std::string /* web_session_id */)

IPC_MESSAGE_ROUTED4(CdmMsg_SessionMessage,
int /* media_keys_id */,
uint32_t /* session_id */,
std::vector<uint8> /* message */,
GURL /* destination_url */)

IPC_MESSAGE_ROUTED2(CdmMsg_SessionReady,
int /* media_keys_id */,
uint32_t /* session_id */)

IPC_MESSAGE_ROUTED2(CdmMsg_SessionClosed,
int /* media_keys_id */,
uint32_t /* session_id */)

IPC_MESSAGE_ROUTED4(CdmMsg_SessionError,
int /* media_keys_id */,
uint32_t /* session_id */,
media::MediaKeys::KeyError /* error_code */,
int /* system_code */)
14 changes: 14 additions & 0 deletions content/common/media/cdm_messages_enums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2014 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.

#ifndef CONTENT_COMMON_MEDIA_CDM_MESSAGES_ENUMS_H_
#define CONTENT_COMMON_MEDIA_CDM_MESSAGES_ENUMS_H_

// Dictates the session type when an EME session is created.
enum CdmHostMsg_CreateSession_Type {
CREATE_SESSION_TYPE_WEBM,
CREATE_SESSION_TYPE_MP4
};

#endif // CONTENT_COMMON_MEDIA_CDM_MESSAGES_ENUMS_H_
60 changes: 0 additions & 60 deletions content/common/media/media_player_messages_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
// IPC messages for android media player.
// Multiply-included message file, hence no include guard.

#include <string>
#include <vector>

#include "base/basictypes.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "content/common/media/media_player_messages_enums_android.h"
#include "ipc/ipc_message_macros.h"
#include "media/base/android/media_player_android.h"
#include "media/base/android/demuxer_stream_player_params.h"
#include "media/base/media_keys.h"
#include "ui/gfx/rect_f.h"
#include "url/gurl.h"

Expand Down Expand Up @@ -280,59 +276,3 @@ IPC_MESSAGE_ROUTED3(MediaPlayerHostMsg_NotifyExternalSurface,
bool /* is_request */,
gfx::RectF /* rect */)
#endif // defined(VIDEO_HOLE)

// Messages for encrypted media extensions API ------------------------------
// TODO(xhwang): Move the following messages to a separate file.
#undef IPC_MESSAGE_START
#define IPC_MESSAGE_START CdmMsgStart

IPC_ENUM_TRAITS(media::MediaKeys::KeyError)
IPC_ENUM_TRAITS(CdmHostMsg_CreateSession_Type)

IPC_MESSAGE_ROUTED3(CdmHostMsg_InitializeCDM,
int /* media_keys_id */,
std::vector<uint8> /* uuid */,
GURL /* frame url */)

IPC_MESSAGE_ROUTED4(CdmHostMsg_CreateSession,
int /* media_keys_id */,
uint32_t /* session_id */,
CdmHostMsg_CreateSession_Type /* type */,
std::vector<uint8> /* init_data */)

IPC_MESSAGE_ROUTED3(CdmHostMsg_UpdateSession,
int /* media_keys_id */,
uint32_t /* session_id */,
std::vector<uint8> /* response */)

IPC_MESSAGE_ROUTED2(CdmHostMsg_ReleaseSession,
int /* media_keys_id */,
uint32_t /* session_id */)

IPC_MESSAGE_ROUTED1(CdmHostMsg_DestroyCdm,
int /* media_keys_id */)

IPC_MESSAGE_ROUTED3(CdmMsg_SessionCreated,
int /* media_keys_id */,
uint32_t /* session_id */,
std::string /* web_session_id */)

IPC_MESSAGE_ROUTED4(CdmMsg_SessionMessage,
int /* media_keys_id */,
uint32_t /* session_id */,
std::vector<uint8> /* message */,
GURL /* destination_url */)

IPC_MESSAGE_ROUTED2(CdmMsg_SessionReady,
int /* media_keys_id */,
uint32_t /* session_id */)

IPC_MESSAGE_ROUTED2(CdmMsg_SessionClosed,
int /* media_keys_id */,
uint32_t /* session_id */)

IPC_MESSAGE_ROUTED4(CdmMsg_SessionError,
int /* media_keys_id */,
uint32_t /* session_id */,
media::MediaKeys::KeyError /* error_code */,
int /* system_code */)
6 changes: 0 additions & 6 deletions content/common/media/media_player_messages_enums_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,4 @@ enum MediaPlayerHostMsg_Initialize_Type {
MEDIA_PLAYER_TYPE_MEDIA_SOURCE,
};

// Dictates the session type when an EME session is created.
enum CdmHostMsg_CreateSession_Type {
CREATE_SESSION_TYPE_WEBM,
CREATE_SESSION_TYPE_MP4,
};

#endif // CONTENT_COMMON_MEDIA_MEDIA_PLAYER_MESSAGES_ENUMS_ANDROID_H_
2 changes: 2 additions & 0 deletions content/content_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@
'common/mac/font_loader.h',
'common/mac/font_loader.mm',
'common/media/audio_messages.h',
'common/media/cdm_messages.h',
'common/media/cdm_messages_enums.h',
'common/media/media_param_traits.cc',
'common/media/media_param_traits.h',
'common/media/media_player_messages_android.h',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "content/common/media/cdm_messages.h"
#include "content/common/media/media_player_messages_android.h"
#include "content/renderer/media/android/proxy_media_keys.h"
#include "content/renderer/media/android/renderer_media_player_manager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "base/basictypes.h"
#include "base/time/time.h"
#include "content/common/media/cdm_messages_enums.h"
#include "content/common/media/media_player_messages_enums_android.h"
#include "content/public/renderer/render_view_observer.h"
#include "media/base/android/media_player_android.h"
Expand Down

0 comments on commit 33fdddf

Please sign in to comment.