Commit 02904044 authored by qinmin@chromium.org's avatar qinmin@chromium.org

Add the SetMediaKeys handler to pass a drm bridge to a MediaSourcePlayer

Adding the message handler so people can work on it.

BUG=163552

Review URL: https://chromiumcodereview.appspot.com/17563002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208072 0039d316-1c4b-4281-b951-d872f2087c98
parent 32e5b0dd
......@@ -508,4 +508,16 @@ void MediaPlayerManagerImpl::RemoveDrmBridge(int media_keys_id) {
}
}
void MediaPlayerManagerImpl::OnSetMediaKeys(int player_id, int media_keys_id) {
MediaPlayerAndroid* player = GetPlayer(player_id);
if (!player)
return;
MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id);
if (!drm_bridge)
return;
// TODO(qinmin): add the logic to decide whether we should create the
// fullscreen surface for EME lv1.
player->SetDrmBridge(drm_bridge);
}
} // namespace content
......@@ -133,6 +133,7 @@ class CONTENT_EXPORT MediaPlayerManagerImpl
const std::string& session_id);
void OnCancelKeyRequest(int media_keys_id, const std::string& session_id);
void OnDurationChanged(int player_id, const base::TimeDelta& duration);
void OnSetMediaKeys(int player_id, int media_keys_id);
#if defined(GOOGLE_TV)
virtual void OnNotifyExternalSurface(
......
......@@ -5,6 +5,7 @@
#include "media/base/android/media_player_android.h"
#include "base/logging.h"
#include "media/base/android/media_drm_bridge.h"
#include "media/base/android/media_player_manager.h"
namespace media {
......@@ -88,4 +89,8 @@ GURL MediaPlayerAndroid::GetFirstPartyForCookies() {
return GURL();
}
void MediaPlayerAndroid::SetDrmBridge(MediaDrmBridge* drm_bridge) {
NOTREACHED() << "Unexpected SetDrmBridge() call";
}
} // namespace media
......@@ -17,6 +17,7 @@
namespace media {
class MediaDrmBridge;
class MediaPlayerManager;
// This class serves as the base class for different media player
......@@ -99,6 +100,9 @@ class MEDIA_EXPORT MediaPlayerAndroid {
// Called when the demuxer has changed the duration.
virtual void DurationChanged(const base::TimeDelta& duration);
// Pass a drm bridge to a player.
virtual void SetDrmBridge(MediaDrmBridge* drm_bridge);
int player_id() { return player_id_; }
protected:
......
......@@ -286,7 +286,8 @@ MediaSourcePlayer::MediaSourcePlayer(
video_access_unit_index_(0),
waiting_for_audio_data_(false),
waiting_for_video_data_(false),
weak_this_(this) {
weak_this_(this),
drm_bridge_(NULL) {
}
MediaSourcePlayer::~MediaSourcePlayer() {
......@@ -471,6 +472,13 @@ void MediaSourcePlayer::DurationChanged(const base::TimeDelta& duration) {
duration_ = duration;
}
void MediaSourcePlayer::SetDrmBridge(MediaDrmBridge* drm_bridge) {
drm_bridge_ = drm_bridge;
// TODO(qinmin): similar to SetVideoSurface() call, we need to wait for the
// current decoder jobs to finish, and then use the ProcessPendingEvents()
// to pass the drm_bridge to the decoder jobs.
}
void MediaSourcePlayer::OnSeekRequestAck(unsigned seek_request_id) {
// Do nothing until the most recent seek request is processed.
if (seek_request_id_ != seek_request_id)
......
......@@ -149,17 +149,12 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
virtual bool CanSeekBackward() OVERRIDE;
virtual bool IsPlayerReady() OVERRIDE;
virtual void OnSeekRequestAck(unsigned seek_request_id) OVERRIDE;
// Called when the demuxer is ready.
virtual void DemuxerReady(
const MediaPlayerHostMsg_DemuxerReady_Params& params) OVERRIDE;
// Called when the requested data is received from the demuxer.
virtual void ReadFromDemuxerAck(
const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) OVERRIDE;
// Called when the demuxer has changed the duration.
virtual void DurationChanged(const base::TimeDelta& duration) OVERRIDE;
virtual void SetDrmBridge(MediaDrmBridge* drm_bridge) OVERRIDE;
private:
// Update the timestamps for A/V sync scheduling.
......@@ -258,6 +253,8 @@ class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid {
// Weak pointer passed to media decoder jobs for callbacks.
base::WeakPtrFactory<MediaSourcePlayer> weak_this_;
MediaDrmBridge* drm_bridge_;
friend class MediaSourcePlayerTest;
DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer);
};
......
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