diff options
author | jrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 07:25:54 +0000 |
---|---|---|
committer | jrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-10 07:25:54 +0000 |
commit | a267ff14ffc271d52522affde71803bd29bca3e3 (patch) | |
tree | c7db4579831244d8071ee8d9205ce571d39d371c | |
parent | 6718537577fc2e16f92beecd8163c3cad95c0ca6 (diff) | |
download | chromium_src-a267ff14ffc271d52522affde71803bd29bca3e3.zip chromium_src-a267ff14ffc271d52522affde71803bd29bca3e3.tar.gz chromium_src-a267ff14ffc271d52522affde71803bd29bca3e3.tar.bz2 |
Rename EME WD call parameters
Rename parameters on EME WD calls to be consistent.
BUG=224786
TEST=compiles
Review URL: https://codereview.chromium.org/105383002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239698 0039d316-1c4b-4281-b951-d872f2087c98
47 files changed, 831 insertions, 832 deletions
diff --git a/content/browser/media/android/browser_media_player_manager.cc b/content/browser/media/android/browser_media_player_manager.cc index 2273b5c..89e6226 100644 --- a/content/browser/media/android/browser_media_player_manager.cc +++ b/content/browser/media/android/browser_media_player_manager.cc @@ -367,38 +367,38 @@ void BrowserMediaPlayerManager::OnProtectedSurfaceRequested(int player_id) { void BrowserMediaPlayerManager::OnSessionCreated( int media_keys_id, - uint32 reference_id, - const std::string& session_id) { + uint32 session_id, + const std::string& web_session_id) { Send(new MediaKeysMsg_SetSessionId( - routing_id(), media_keys_id, reference_id, session_id)); + routing_id(), media_keys_id, session_id, web_session_id)); } void BrowserMediaPlayerManager::OnSessionMessage( int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) { Send(new MediaKeysMsg_KeyMessage( - routing_id(), media_keys_id, reference_id, message, destination_url)); + routing_id(), media_keys_id, session_id, message, destination_url)); } void BrowserMediaPlayerManager::OnSessionReady(int media_keys_id, - uint32 reference_id) { - Send(new MediaKeysMsg_KeyAdded(routing_id(), media_keys_id, reference_id)); + uint32 session_id) { + Send(new MediaKeysMsg_KeyAdded(routing_id(), media_keys_id, session_id)); } void BrowserMediaPlayerManager::OnSessionClosed(int media_keys_id, - uint32 reference_id) { + uint32 session_id) { // TODO(jrummell): Update Android calls and IPC names. } void BrowserMediaPlayerManager::OnSessionError( int media_keys_id, - uint32 reference_id, + uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) { - Send(new MediaKeysMsg_KeyError(routing_id(), media_keys_id, - reference_id, error_code, system_code)); + Send(new MediaKeysMsg_KeyError( + routing_id(), media_keys_id, session_id, error_code, system_code)); } #if defined(GOOGLE_TV) @@ -554,12 +554,12 @@ void BrowserMediaPlayerManager::OnInitializeCDM( void BrowserMediaPlayerManager::OnGenerateKeyRequest( int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::string& type, const std::vector<uint8>& init_data) { if (CommandLine::ForCurrentProcess() ->HasSwitch(switches::kDisableInfobarForProtectedMediaIdentifier)) { - GenerateKeyIfAllowed(media_keys_id, reference_id, type, init_data, true); + GenerateKeyIfAllowed(media_keys_id, session_id, type, init_data, true); return; } @@ -567,7 +567,7 @@ void BrowserMediaPlayerManager::OnGenerateKeyRequest( if (!drm_bridge) { DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; OnSessionError( - media_keys_id, reference_id, media::MediaKeys::kUnknownError, 0); + media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); return; } @@ -581,25 +581,25 @@ void BrowserMediaPlayerManager::OnGenerateKeyRequest( base::Bind(&BrowserMediaPlayerManager::GenerateKeyIfAllowed, weak_ptr_factory_.GetWeakPtr(), media_keys_id, - reference_id, + session_id, type, init_data)); } void BrowserMediaPlayerManager::OnAddKey(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& key, const std::vector<uint8>& init_data) { MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); if (!drm_bridge) { DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; OnSessionError( - media_keys_id, reference_id, media::MediaKeys::kUnknownError, 0); + media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); return; } DCHECK(init_data.empty()); - drm_bridge->UpdateSession(reference_id, &key[0], key.size()); + drm_bridge->UpdateSession(session_id, &key[0], key.size()); // In EME v0.1b MediaKeys lives in the media element. So the |media_keys_id| // is the same as the |player_id|. // TODO(xhwang): Separate |media_keys_id| and |player_id|. @@ -608,18 +608,17 @@ void BrowserMediaPlayerManager::OnAddKey(int media_keys_id, player->OnKeyAdded(); } -void BrowserMediaPlayerManager::OnCancelKeyRequest( - int media_keys_id, - uint32 reference_id) { +void BrowserMediaPlayerManager::OnCancelKeyRequest(int media_keys_id, + uint32 session_id) { MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); if (!drm_bridge) { DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; OnSessionError( - media_keys_id, reference_id, media::MediaKeys::kUnknownError, 0); + media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); return; } - drm_bridge->ReleaseSession(reference_id); + drm_bridge->ReleaseSession(session_id); } void BrowserMediaPlayerManager::AddPlayer(MediaPlayerAndroid* player) { @@ -716,7 +715,7 @@ void BrowserMediaPlayerManager::OnSetMediaKeys(int player_id, void BrowserMediaPlayerManager::GenerateKeyIfAllowed( int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::string& type, const std::vector<uint8>& init_data, bool allowed) { @@ -727,13 +726,12 @@ void BrowserMediaPlayerManager::GenerateKeyIfAllowed( if (!drm_bridge) { DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; OnSessionError( - media_keys_id, reference_id, media::MediaKeys::kUnknownError, 0); + media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); return; } media_keys_ids_pending_approval_.erase(media_keys_id); media_keys_ids_approved_.insert(media_keys_id); - drm_bridge->CreateSession( - reference_id, type, &init_data[0], init_data.size()); + drm_bridge->CreateSession(session_id, type, &init_data[0], init_data.size()); // TODO(qinmin): currently |media_keys_id| and player ID are identical. // This might not be true in the future. diff --git a/content/browser/media/android/browser_media_player_manager.h b/content/browser/media/android/browser_media_player_manager.h index cee6be5..4f8cf85 100644 --- a/content/browser/media/android/browser_media_player_manager.h +++ b/content/browser/media/android/browser_media_player_manager.h @@ -91,16 +91,16 @@ class CONTENT_EXPORT BrowserMediaPlayerManager virtual void DestroyAllMediaPlayers() OVERRIDE; virtual void OnProtectedSurfaceRequested(int player_id) OVERRIDE; virtual void OnSessionCreated(int media_keys_id, - uint32 reference_id, - const std::string& session_id) OVERRIDE; + uint32 session_id, + const std::string& web_session_id) OVERRIDE; virtual void OnSessionMessage(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) OVERRIDE; - virtual void OnSessionReady(int media_keys_id, uint32 reference_id) OVERRIDE; - virtual void OnSessionClosed(int media_keys_id, uint32 reference_id) OVERRIDE; + virtual void OnSessionReady(int media_keys_id, uint32 session_id) OVERRIDE; + virtual void OnSessionClosed(int media_keys_id, uint32 session_id) OVERRIDE; virtual void OnSessionError(int media_keys_id, - uint32 reference_id, + uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) OVERRIDE; @@ -136,14 +136,14 @@ class CONTENT_EXPORT BrowserMediaPlayerManager const std::vector<uint8>& uuid, const GURL& frame_url); void OnGenerateKeyRequest(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::string& type, const std::vector<uint8>& init_data); void OnAddKey(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& key, const std::vector<uint8>& init_data); - void OnCancelKeyRequest(int media_keys_id, uint32 reference_id); + void OnCancelKeyRequest(int media_keys_id, uint32 session_id); void OnSetMediaKeys(int player_id, int media_keys_id); #if defined(GOOGLE_TV) @@ -175,7 +175,7 @@ class CONTENT_EXPORT BrowserMediaPlayerManager private: void GenerateKeyIfAllowed(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::string& type, const std::vector<uint8>& init_data, bool allowed); diff --git a/content/common/media/media_player_messages_android.h b/content/common/media/media_player_messages_android.h index 054fb22..96a45ff 100644 --- a/content/common/media/media_player_messages_android.h +++ b/content/common/media/media_player_messages_android.h @@ -289,37 +289,37 @@ IPC_MESSAGE_ROUTED3(MediaKeysHostMsg_InitializeCDM, IPC_MESSAGE_ROUTED4(MediaKeysHostMsg_GenerateKeyRequest, int /* media_keys_id */, - uint32_t /* reference_id */, + uint32_t /* session_id */, std::string /* type */, std::vector<uint8> /* init_data */) IPC_MESSAGE_ROUTED4(MediaKeysHostMsg_AddKey, int /* media_keys_id */, - uint32_t /* reference_id */, + uint32_t /* session_id */, std::vector<uint8> /* key */, std::vector<uint8> /* init_data */) IPC_MESSAGE_ROUTED2(MediaKeysHostMsg_CancelKeyRequest, int /* media_keys_id */, - uint32_t /* reference_id */) + uint32_t /* session_id */) IPC_MESSAGE_ROUTED2(MediaKeysMsg_KeyAdded, int /* media_keys_id */, - uint32_t /* reference_id */) + uint32_t /* session_id */) IPC_MESSAGE_ROUTED4(MediaKeysMsg_KeyError, int /* media_keys_id */, - uint32_t /* reference_id */, + uint32_t /* session_id */, media::MediaKeys::KeyError /* error_code */, int /* system_code */) IPC_MESSAGE_ROUTED4(MediaKeysMsg_KeyMessage, int /* media_keys_id */, - uint32_t /* reference_id */, + uint32_t /* session_id */, std::vector<uint8> /* message */, std::string /* destination_url */) IPC_MESSAGE_ROUTED3(MediaKeysMsg_SetSessionId, int /* media_keys_id */, - uint32_t /* reference_id */, - std::string /* session_id */) + uint32_t /* session_id */, + std::string /* web_session_id */) diff --git a/content/renderer/media/android/proxy_media_keys.cc b/content/renderer/media/android/proxy_media_keys.cc index d7bb6cb..ed7991a 100644 --- a/content/renderer/media/android/proxy_media_keys.cc +++ b/content/renderer/media/android/proxy_media_keys.cc @@ -45,54 +45,54 @@ void ProxyMediaKeys::InitializeCDM(const std::string& key_system, #endif } -bool ProxyMediaKeys::CreateSession(uint32 reference_id, +bool ProxyMediaKeys::CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) { manager_->GenerateKeyRequest( media_keys_id_, - reference_id, + session_id, type, std::vector<uint8>(init_data, init_data + init_data_length)); return true; } -void ProxyMediaKeys::UpdateSession(uint32 reference_id, +void ProxyMediaKeys::UpdateSession(uint32 session_id, const uint8* response, int response_length) { manager_->AddKey(media_keys_id_, - reference_id, + session_id, std::vector<uint8>(response, response + response_length), std::vector<uint8>()); } -void ProxyMediaKeys::ReleaseSession(uint32 reference_id) { - manager_->CancelKeyRequest(media_keys_id_, reference_id); +void ProxyMediaKeys::ReleaseSession(uint32 session_id) { + manager_->CancelKeyRequest(media_keys_id_, session_id); } -void ProxyMediaKeys::OnSessionCreated(uint32 reference_id, - const std::string& session_id) { - session_created_cb_.Run(reference_id, session_id); +void ProxyMediaKeys::OnSessionCreated(uint32 session_id, + const std::string& web_session_id) { + session_created_cb_.Run(session_id, web_session_id); } -void ProxyMediaKeys::OnSessionMessage(uint32 reference_id, +void ProxyMediaKeys::OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) { - session_message_cb_.Run(reference_id, message, destination_url); + session_message_cb_.Run(session_id, message, destination_url); } -void ProxyMediaKeys::OnSessionReady(uint32 reference_id) { - session_ready_cb_.Run(reference_id); +void ProxyMediaKeys::OnSessionReady(uint32 session_id) { + session_ready_cb_.Run(session_id); } -void ProxyMediaKeys::OnSessionClosed(uint32 reference_id) { - session_closed_cb_.Run(reference_id); +void ProxyMediaKeys::OnSessionClosed(uint32 session_id) { + session_closed_cb_.Run(session_id); } -void ProxyMediaKeys::OnSessionError(uint32 reference_id, +void ProxyMediaKeys::OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) { - session_error_cb_.Run(reference_id, error_code, system_code); + session_error_cb_.Run(session_id, error_code, system_code); } } // namespace content diff --git a/content/renderer/media/android/proxy_media_keys.h b/content/renderer/media/android/proxy_media_keys.h index 43a40605..ca5c932 100644 --- a/content/renderer/media/android/proxy_media_keys.h +++ b/content/renderer/media/android/proxy_media_keys.h @@ -32,23 +32,23 @@ class ProxyMediaKeys : public media::MediaKeys { void InitializeCDM(const std::string& key_system, const GURL& frame_url); // MediaKeys implementation. - virtual bool CreateSession(uint32 reference_id, + virtual bool CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) OVERRIDE; - virtual void UpdateSession(uint32 reference_id, + virtual void UpdateSession(uint32 session_id, const uint8* response, int response_length) OVERRIDE; - virtual void ReleaseSession(uint32 reference_id) OVERRIDE; + virtual void ReleaseSession(uint32 session_id) OVERRIDE; // Callbacks. - void OnSessionCreated(uint32 reference_id, const std::string& session_id); - void OnSessionMessage(uint32 reference_id, + void OnSessionCreated(uint32 session_id, const std::string& web_session_id); + void OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url); - void OnSessionReady(uint32 reference_id); - void OnSessionClosed(uint32 reference_id); - void OnSessionError(uint32 reference_id, + void OnSessionReady(uint32 session_id); + void OnSessionClosed(uint32 session_id); + void OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code); diff --git a/content/renderer/media/android/renderer_media_player_manager.cc b/content/renderer/media/android/renderer_media_player_manager.cc index d75a7e3..f94185f 100644 --- a/content/renderer/media/android/renderer_media_player_manager.cc +++ b/content/renderer/media/android/renderer_media_player_manager.cc @@ -235,68 +235,68 @@ void RendererMediaPlayerManager::InitializeCDM(int media_keys_id, void RendererMediaPlayerManager::GenerateKeyRequest( int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::string& type, const std::vector<uint8>& init_data) { Send(new MediaKeysHostMsg_GenerateKeyRequest( - routing_id(), media_keys_id, reference_id, type, init_data)); + routing_id(), media_keys_id, session_id, type, init_data)); } void RendererMediaPlayerManager::AddKey(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& key, const std::vector<uint8>& init_data) { Send(new MediaKeysHostMsg_AddKey( - routing_id(), media_keys_id, reference_id, key, init_data)); + routing_id(), media_keys_id, session_id, key, init_data)); } void RendererMediaPlayerManager::CancelKeyRequest(int media_keys_id, - uint32 reference_id) { + uint32 session_id) { Send(new MediaKeysHostMsg_CancelKeyRequest( - routing_id(), media_keys_id, reference_id)); + routing_id(), media_keys_id, session_id)); } void RendererMediaPlayerManager::OnSessionCreated( int media_keys_id, - uint32 reference_id, - const std::string& session_id) { + uint32 session_id, + const std::string& web_session_id) { ProxyMediaKeys* media_keys = GetMediaKeys(media_keys_id); if (media_keys) - media_keys->OnSessionCreated(reference_id, session_id); + media_keys->OnSessionCreated(session_id, web_session_id); } void RendererMediaPlayerManager::OnSessionMessage( int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) { ProxyMediaKeys* media_keys = GetMediaKeys(media_keys_id); if (media_keys) - media_keys->OnSessionMessage(reference_id, message, destination_url); + media_keys->OnSessionMessage(session_id, message, destination_url); } void RendererMediaPlayerManager::OnSessionReady(int media_keys_id, - uint32 reference_id) { + uint32 session_id) { ProxyMediaKeys* media_keys = GetMediaKeys(media_keys_id); if (media_keys) - media_keys->OnSessionReady(reference_id); + media_keys->OnSessionReady(session_id); } void RendererMediaPlayerManager::OnSessionClosed(int media_keys_id, - uint32 reference_id) { + uint32 session_id) { ProxyMediaKeys* media_keys = GetMediaKeys(media_keys_id); if (media_keys) - media_keys->OnSessionClosed(reference_id); + media_keys->OnSessionClosed(session_id); } void RendererMediaPlayerManager::OnSessionError( int media_keys_id, - uint32 reference_id, + uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) { ProxyMediaKeys* media_keys = GetMediaKeys(media_keys_id); if (media_keys) - media_keys->OnSessionError(reference_id, error_code, system_code); + media_keys->OnSessionError(session_id, error_code, system_code); } int RendererMediaPlayerManager::RegisterMediaPlayer( diff --git a/content/renderer/media/android/renderer_media_player_manager.h b/content/renderer/media/android/renderer_media_player_manager.h index 6830a71..50cefad 100644 --- a/content/renderer/media/android/renderer_media_player_manager.h +++ b/content/renderer/media/android/renderer_media_player_manager.h @@ -94,14 +94,14 @@ class RendererMediaPlayerManager : public RenderViewObserver { const std::vector<uint8>& uuid, const GURL& frame_url); void GenerateKeyRequest(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::string& type, const std::vector<uint8>& init_data); void AddKey(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& key, const std::vector<uint8>& init_data); - void CancelKeyRequest(int media_keys_id, uint32 reference_id); + void CancelKeyRequest(int media_keys_id, uint32 session_id); // Registers and unregisters a WebMediaPlayerAndroid object. int RegisterMediaPlayer(WebMediaPlayerAndroid* player); @@ -161,16 +161,16 @@ class RendererMediaPlayerManager : public RenderViewObserver { void OnPlayerPause(int player_id); void OnRequestFullscreen(int player_id); void OnSessionCreated(int media_keys_id, - uint32 reference_id, - const std::string& session_id); + uint32 session_id, + const std::string& web_session_id); void OnSessionMessage(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url); - void OnSessionReady(int media_keys_id, uint32 reference_id); - void OnSessionClosed(int media_keys_id, uint32 reference_id); + void OnSessionReady(int media_keys_id, uint32 session_id); + void OnSessionClosed(int media_keys_id, uint32 session_id); void OnSessionError(int media_keys_id, - uint32 reference_id, + uint32 session_id, media::MediaKeys::KeyError error_code, int system_code); diff --git a/content/renderer/media/crypto/ppapi_decryptor.cc b/content/renderer/media/crypto/ppapi_decryptor.cc index becaa18..aff94a2 100644 --- a/content/renderer/media/crypto/ppapi_decryptor.cc +++ b/content/renderer/media/crypto/ppapi_decryptor.cc @@ -93,7 +93,7 @@ PpapiDecryptor::~PpapiDecryptor() { destroy_plugin_cb_.Run(); } -bool PpapiDecryptor::CreateSession(uint32 reference_id, +bool PpapiDecryptor::CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) { @@ -102,23 +102,23 @@ bool PpapiDecryptor::CreateSession(uint32 reference_id, DCHECK(plugin_cdm_delegate_); if (!plugin_cdm_delegate_->CreateSession( - reference_id, type, init_data, init_data_length)) { - ReportFailureToCallPlugin(reference_id); + session_id, type, init_data, init_data_length)) { + ReportFailureToCallPlugin(session_id); return false; } return true; } -void PpapiDecryptor::UpdateSession(uint32 reference_id, +void PpapiDecryptor::UpdateSession(uint32 session_id, const uint8* response, int response_length) { DVLOG(2) << __FUNCTION__; DCHECK(render_loop_proxy_->BelongsToCurrentThread()); if (!plugin_cdm_delegate_->UpdateSession( - reference_id, response, response_length)) - ReportFailureToCallPlugin(reference_id); + session_id, response, response_length)) + ReportFailureToCallPlugin(session_id); if (!new_audio_key_cb_.is_null()) new_audio_key_cb_.Run(); @@ -127,12 +127,12 @@ void PpapiDecryptor::UpdateSession(uint32 reference_id, new_video_key_cb_.Run(); } -void PpapiDecryptor::ReleaseSession(uint32 reference_id) { +void PpapiDecryptor::ReleaseSession(uint32 session_id) { DVLOG(2) << __FUNCTION__; DCHECK(render_loop_proxy_->BelongsToCurrentThread()); - if (!plugin_cdm_delegate_->ReleaseSession(reference_id)) - ReportFailureToCallPlugin(reference_id); + if (!plugin_cdm_delegate_->ReleaseSession(session_id)) + ReportFailureToCallPlugin(session_id); } media::Decryptor* PpapiDecryptor::GetDecryptor() { @@ -293,10 +293,10 @@ void PpapiDecryptor::DeinitializeDecoder(StreamType stream_type) { plugin_cdm_delegate_->DeinitializeDecoder(stream_type); } -void PpapiDecryptor::ReportFailureToCallPlugin(uint32 reference_id) { +void PpapiDecryptor::ReportFailureToCallPlugin(uint32 session_id) { DCHECK(render_loop_proxy_->BelongsToCurrentThread()); DVLOG(1) << "Failed to call plugin."; - session_error_cb_.Run(reference_id, kUnknownError, 0); + session_error_cb_.Run(session_id, kUnknownError, 0); } void PpapiDecryptor::OnDecoderInitialized(StreamType stream_type, @@ -316,34 +316,34 @@ void PpapiDecryptor::OnDecoderInitialized(StreamType stream_type, } } -void PpapiDecryptor::OnSessionCreated(uint32 reference_id, - const std::string& session_id) { +void PpapiDecryptor::OnSessionCreated(uint32 session_id, + const std::string& web_session_id) { DCHECK(render_loop_proxy_->BelongsToCurrentThread()); - session_created_cb_.Run(reference_id, session_id); + session_created_cb_.Run(session_id, web_session_id); } -void PpapiDecryptor::OnSessionMessage(uint32 reference_id, +void PpapiDecryptor::OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) { DCHECK(render_loop_proxy_->BelongsToCurrentThread()); - session_message_cb_.Run(reference_id, message, destination_url); + session_message_cb_.Run(session_id, message, destination_url); } -void PpapiDecryptor::OnSessionReady(uint32 reference_id) { +void PpapiDecryptor::OnSessionReady(uint32 session_id) { DCHECK(render_loop_proxy_->BelongsToCurrentThread()); - session_ready_cb_.Run(reference_id); + session_ready_cb_.Run(session_id); } -void PpapiDecryptor::OnSessionClosed(uint32 reference_id) { +void PpapiDecryptor::OnSessionClosed(uint32 session_id) { DCHECK(render_loop_proxy_->BelongsToCurrentThread()); - session_closed_cb_.Run(reference_id); + session_closed_cb_.Run(session_id); } -void PpapiDecryptor::OnSessionError(uint32 reference_id, +void PpapiDecryptor::OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) { DCHECK(render_loop_proxy_->BelongsToCurrentThread()); - session_error_cb_.Run(reference_id, error_code, system_code); + session_error_cb_.Run(session_id, error_code, system_code); } } // namespace content diff --git a/content/renderer/media/crypto/ppapi_decryptor.h b/content/renderer/media/crypto/ppapi_decryptor.h index 875233c..95c5f74 100644 --- a/content/renderer/media/crypto/ppapi_decryptor.h +++ b/content/renderer/media/crypto/ppapi_decryptor.h @@ -42,14 +42,14 @@ class PpapiDecryptor : public media::MediaKeys, public media::Decryptor { virtual ~PpapiDecryptor(); // media::MediaKeys implementation. - virtual bool CreateSession(uint32 reference_id, + virtual bool CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) OVERRIDE; - virtual void UpdateSession(uint32 reference_id, + virtual void UpdateSession(uint32 session_id, const uint8* response, int response_length) OVERRIDE; - virtual void ReleaseSession(uint32 reference_id) OVERRIDE; + virtual void ReleaseSession(uint32 session_id) OVERRIDE; virtual Decryptor* GetDecryptor() OVERRIDE; // media::Decryptor implementation. @@ -82,18 +82,18 @@ class PpapiDecryptor : public media::MediaKeys, public media::Decryptor { const media::SessionErrorCB& session_error_cb, const base::Closure& destroy_plugin_cb); - void ReportFailureToCallPlugin(uint32 reference_id); + void ReportFailureToCallPlugin(uint32 session_id); void OnDecoderInitialized(StreamType stream_type, bool success); // Callbacks for |plugin_cdm_delegate_| to fire session events. - void OnSessionCreated(uint32 reference_id, const std::string& session_id); - void OnSessionMessage(uint32 reference_id, + void OnSessionCreated(uint32 session_id, const std::string& web_session_id); + void OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url); - void OnSessionReady(uint32 reference_id); - void OnSessionClosed(uint32 reference_id); - void OnSessionError(uint32 reference_id, + void OnSessionReady(uint32 session_id); + void OnSessionClosed(uint32 session_id); + void OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code); diff --git a/content/renderer/media/crypto/proxy_decryptor.cc b/content/renderer/media/crypto/proxy_decryptor.cc index 4716405..0016d19 100644 --- a/content/renderer/media/crypto/proxy_decryptor.cc +++ b/content/renderer/media/crypto/proxy_decryptor.cc @@ -21,9 +21,9 @@ namespace content { // WebContentDecryptionModuleSessionImpl for the short time both paths are // active, start with 100000 and generate the IDs from there. // TODO(jrummell): Only allow one path http://crbug.com/306680. -uint32 ProxyDecryptor::next_reference_id_ = 100000; +uint32 ProxyDecryptor::next_session_id_ = 100000; -const uint32 INVALID_REFERENCE_ID = 0; +const uint32 kInvalidSessionId = 0; #if defined(ENABLE_PEPPER_CDMS) void ProxyDecryptor::DestroyHelperPlugin() { @@ -116,9 +116,9 @@ bool ProxyDecryptor::GenerateKeyRequest(const std::string& type, const uint8* init_data, int init_data_length) { // Use a unique reference id for this request. - uint32 reference_id = next_reference_id_++; + uint32 session_id = next_session_id_++; if (!media_keys_->CreateSession( - reference_id, type, init_data, init_data_length)) { + session_id, type, init_data, init_data_length)) { media_keys_.reset(); return false; } @@ -130,12 +130,12 @@ void ProxyDecryptor::AddKey(const uint8* key, int key_length, const uint8* init_data, int init_data_length, - const std::string& session_id) { + const std::string& web_session_id) { DVLOG(1) << "AddKey()"; // WebMediaPlayerImpl ensures GenerateKeyRequest() has been called. - uint32 reference_id = LookupReferenceId(session_id); - if (reference_id == INVALID_REFERENCE_ID) { + uint32 session_id = LookupSessionId(web_session_id); + if (session_id == kInvalidSessionId) { // Session hasn't been referenced before, so it is an error. // Note that the specification says "If sessionId is not null and is // unrecognized, throw an INVALID_ACCESS_ERR." However, for backwards @@ -162,25 +162,25 @@ void ProxyDecryptor::AddKey(const uint8* key, media::GenerateJWKSet(key, key_length, init_data, init_data_length); DCHECK(!jwk.empty()); media_keys_->UpdateSession( - reference_id, reinterpret_cast<const uint8*>(jwk.data()), jwk.size()); + session_id, reinterpret_cast<const uint8*>(jwk.data()), jwk.size()); return; } - media_keys_->UpdateSession(reference_id, key, key_length); + media_keys_->UpdateSession(session_id, key, key_length); } void ProxyDecryptor::CancelKeyRequest(const std::string& session_id) { DVLOG(1) << "CancelKeyRequest()"; // WebMediaPlayerImpl ensures GenerateKeyRequest() has been called. - uint32 reference_id = LookupReferenceId(session_id); - if (reference_id == INVALID_REFERENCE_ID) { + uint32 session_reference_id = LookupSessionId(session_id); + if (session_reference_id == kInvalidSessionId) { // Session hasn't been created, so it is an error. key_error_cb_.Run( std::string(), media::MediaKeys::kUnknownError, 0); } else { - media_keys_->ReleaseSession(reference_id); + media_keys_->ReleaseSession(session_reference_id); } } @@ -211,40 +211,40 @@ scoped_ptr<media::MediaKeys> ProxyDecryptor::CreateMediaKeys( weak_ptr_factory_.GetWeakPtr())); } -void ProxyDecryptor::OnSessionCreated(uint32 reference_id, - const std::string& session_id) { +void ProxyDecryptor::OnSessionCreated(uint32 session_id, + const std::string& web_session_id) { // Due to heartbeat messages, OnSessionCreated() can get called multiple // times. - SessionIdMap::iterator it = sessions_.find(reference_id); - DCHECK(it == sessions_.end() || it->second == session_id); + SessionIdMap::iterator it = sessions_.find(session_id); + DCHECK(it == sessions_.end() || it->second == web_session_id); if (it == sessions_.end()) - sessions_[reference_id] = session_id; + sessions_[session_id] = web_session_id; } -void ProxyDecryptor::OnSessionMessage(uint32 reference_id, +void ProxyDecryptor::OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) { // Assumes that OnSessionCreated() has been called before this. - key_message_cb_.Run(LookupSessionId(reference_id), message, destination_url); + key_message_cb_.Run(LookupWebSessionId(session_id), message, destination_url); } -void ProxyDecryptor::OnSessionReady(uint32 reference_id) { +void ProxyDecryptor::OnSessionReady(uint32 session_id) { // Assumes that OnSessionCreated() has been called before this. - key_added_cb_.Run(LookupSessionId(reference_id)); + key_added_cb_.Run(LookupWebSessionId(session_id)); } -void ProxyDecryptor::OnSessionClosed(uint32 reference_id) { +void ProxyDecryptor::OnSessionClosed(uint32 session_id) { // No closed event in EME v0.1b. } -void ProxyDecryptor::OnSessionError(uint32 reference_id, +void ProxyDecryptor::OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) { // Assumes that OnSessionCreated() has been called before this. - key_error_cb_.Run(LookupSessionId(reference_id), error_code, system_code); + key_error_cb_.Run(LookupWebSessionId(session_id), error_code, system_code); } -uint32 ProxyDecryptor::LookupReferenceId(const std::string& session_id) { +uint32 ProxyDecryptor::LookupSessionId(const std::string& session_id) { for (SessionIdMap::iterator it = sessions_.begin(); it != sessions_.end(); ++it) { @@ -256,14 +256,14 @@ uint32 ProxyDecryptor::LookupReferenceId(const std::string& session_id) { if (session_id.empty() && sessions_.size() == 1) return sessions_.begin()->first; - return INVALID_REFERENCE_ID; + return kInvalidSessionId; } -const std::string& ProxyDecryptor::LookupSessionId(uint32 reference_id) { - DCHECK_NE(reference_id, INVALID_REFERENCE_ID); +const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) { + DCHECK_NE(session_id, kInvalidSessionId); // Session may not exist if error happens during GenerateKeyRequest(). - SessionIdMap::iterator it = sessions_.find(reference_id); + SessionIdMap::iterator it = sessions_.find(session_id); return (it != sessions_.end()) ? it->second : base::EmptyString(); } diff --git a/content/renderer/media/crypto/proxy_decryptor.h b/content/renderer/media/crypto/proxy_decryptor.h index 3ffec58..026b56a 100644 --- a/content/renderer/media/crypto/proxy_decryptor.h +++ b/content/renderer/media/crypto/proxy_decryptor.h @@ -35,9 +35,11 @@ class RendererMediaPlayerManager; // A decryptor proxy that creates a real decryptor object on demand and // forwards decryptor calls to it. // -// Now that the Pepper API calls use reference ID to match responses with -// requests, this class maintains a mapping between reference ID and session ID. -// Callers of this class expect session IDs in the responses. +// Now that the Pepper API calls use session ID to match responses with +// requests, this class maintains a mapping between session ID and web session +// ID. Callers of this class expect web session IDs in the responses. +// Session IDs are internal unique references to the session. Web session IDs +// are the CDM generated ID for the session, and are what are visible to users. // // TODO(xhwang): Currently we don't support run-time switching among decryptor // objects. Fix this when needed. @@ -45,7 +47,7 @@ class RendererMediaPlayerManager; class ProxyDecryptor { public: // These are similar to the callbacks in media_keys.h, but pass back the - // session ID rather than a reference ID. + // web session ID rather than the internal session ID. typedef base::Callback<void(const std::string& session_id)> KeyAddedCB; typedef base::Callback<void(const std::string& session_id, media::MediaKeys::KeyError error_code, @@ -86,7 +88,7 @@ class ProxyDecryptor { void CancelKeyRequest(const std::string& session_id); private: - // This is reference_id <-> session_id map. + // Session_id <-> web_session_id map. typedef std::map<uint32, std::string> SessionIdMap; // Helper function to create MediaKeys to handle the given |key_system|. @@ -94,23 +96,23 @@ class ProxyDecryptor { const GURL& frame_url); // Callbacks for firing session events. - void OnSessionCreated(uint32 reference_id, const std::string& session_id); - void OnSessionMessage(uint32 reference_id, + void OnSessionCreated(uint32 session_id, const std::string& web_session_id); + void OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& default_url); - void OnSessionReady(uint32 reference_id); - void OnSessionClosed(uint32 reference_id); - void OnSessionError(uint32 reference_id, + void OnSessionReady(uint32 session_id); + void OnSessionClosed(uint32 session_id); + void OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code); - // Helper function to determine reference_id for the provided |session_id|. - uint32 LookupReferenceId(const std::string& session_id); + // Helper function to determine session_id for the provided |web_session_id|. + uint32 LookupSessionId(const std::string& web_session_id); - // Helper function to determine session_id for the provided |reference_id|. - // The returned session_id is only valid on the main thread, and should be + // Helper function to determine web_session_id for the provided |session_id|. + // The returned web_session_id is only valid on the main thread, and should be // stored by copy. - const std::string& LookupSessionId(uint32 reference_id); + const std::string& LookupWebSessionId(uint32 session_id); base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; @@ -141,10 +143,10 @@ class ProxyDecryptor { media::DecryptorReadyCB decryptor_ready_cb_; - // Reference IDs are used to uniquely track sessions so that CDM callbacks - // can get mapped to the correct session ID. Reference ID should be unique + // Session IDs are used to uniquely track sessions so that CDM callbacks + // can get mapped to the correct session ID. Session ID should be unique // per renderer process for debugging purposes. - static uint32 next_reference_id_; + static uint32 next_session_id_; SessionIdMap sessions_; diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc index d320124..14bbc8d 100644 --- a/content/renderer/media/webcontentdecryptionmodule_impl.cc +++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc @@ -20,61 +20,72 @@ namespace content { -// Forwards the reference ID-based callbacks of the MediaKeys interface to the +// Forwards the session ID-based callbacks of the MediaKeys interface to the // appropriate session object. -class ReferenceIdAdapter { +class SessionIdAdapter { public: - ReferenceIdAdapter(); - ~ReferenceIdAdapter(); + SessionIdAdapter(); + ~SessionIdAdapter(); // On success, creates a MediaKeys, returns it in |media_keys|, returns true. bool Initialize(const std::string& key_system, scoped_ptr<media::MediaKeys>* media_keys); + // Generates a unique internal session id. + uint32 GenerateSessionId(); + // Adds a session to the internal map. Does not take ownership of the session. - void AddSession(uint32 reference_id, + void AddSession(uint32 session_id, WebContentDecryptionModuleSessionImpl* session); // Removes a session from the internal map. - void RemoveSession(uint32 reference_id); + void RemoveSession(uint32 session_id); private: typedef std::map<uint32, WebContentDecryptionModuleSessionImpl*> SessionMap; // Callbacks for firing session events. - void OnSessionCreated(uint32 reference_id, const std::string& session_id); - void OnSessionMessage(uint32 reference_id, + void OnSessionCreated(uint32 session_id, const std::string& web_session_id); + void OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url); - void OnSessionReady(uint32 reference_id); - void OnSessionClosed(uint32 reference_id); - void OnSessionError(uint32 reference_id, + void OnSessionReady(uint32 session_id); + void OnSessionClosed(uint32 session_id); + void OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code); // Helper function of the callbacks. - WebContentDecryptionModuleSessionImpl* GetSession(uint32 reference_id); + WebContentDecryptionModuleSessionImpl* GetSession(uint32 session_id); - base::WeakPtrFactory<ReferenceIdAdapter> weak_ptr_factory_; + base::WeakPtrFactory<SessionIdAdapter> weak_ptr_factory_; SessionMap sessions_; - DISALLOW_COPY_AND_ASSIGN(ReferenceIdAdapter); + // Session ID should be unique per renderer process for debugging purposes. + static uint32 next_session_id_; + + DISALLOW_COPY_AND_ASSIGN(SessionIdAdapter); }; -ReferenceIdAdapter::ReferenceIdAdapter() +const uint32 kStartingSessionId = 1; +uint32 SessionIdAdapter::next_session_id_ = kStartingSessionId; +COMPILE_ASSERT(kStartingSessionId > media::MediaKeys::kInvalidSessionId, + invalid_starting_value); + +SessionIdAdapter::SessionIdAdapter() : weak_ptr_factory_(this) { } -ReferenceIdAdapter::~ReferenceIdAdapter() { +SessionIdAdapter::~SessionIdAdapter() { } -bool ReferenceIdAdapter::Initialize(const std::string& key_system, - scoped_ptr<media::MediaKeys>* media_keys) { +bool SessionIdAdapter::Initialize(const std::string& key_system, + scoped_ptr<media::MediaKeys>* media_keys) { DCHECK(media_keys); DCHECK(!*media_keys); - base::WeakPtr<ReferenceIdAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); + base::WeakPtr<SessionIdAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); scoped_ptr<media::MediaKeys> created_media_keys = ContentDecryptionModuleFactory::Create( // TODO(ddorwin): Address lower in the stack: http://crbug.com/252065 @@ -91,11 +102,11 @@ bool ReferenceIdAdapter::Initialize(const std::string& key_system, // TODO(ddorwin): Get the URL for the frame containing the MediaKeys. GURL(), #endif // defined(ENABLE_PEPPER_CDMS) - base::Bind(&ReferenceIdAdapter::OnSessionCreated, weak_this), - base::Bind(&ReferenceIdAdapter::OnSessionMessage, weak_this), - base::Bind(&ReferenceIdAdapter::OnSessionReady, weak_this), - base::Bind(&ReferenceIdAdapter::OnSessionClosed, weak_this), - base::Bind(&ReferenceIdAdapter::OnSessionError, weak_this)); + base::Bind(&SessionIdAdapter::OnSessionCreated, weak_this), + base::Bind(&SessionIdAdapter::OnSessionMessage, weak_this), + base::Bind(&SessionIdAdapter::OnSessionReady, weak_this), + base::Bind(&SessionIdAdapter::OnSessionClosed, weak_this), + base::Bind(&SessionIdAdapter::OnSessionError, weak_this)); if (!created_media_keys) return false; @@ -103,47 +114,51 @@ bool ReferenceIdAdapter::Initialize(const std::string& key_system, return true; } -void ReferenceIdAdapter::AddSession( - uint32 reference_id, +uint32 SessionIdAdapter::GenerateSessionId() { + return next_session_id_++; +} + +void SessionIdAdapter::AddSession( + uint32 session_id, WebContentDecryptionModuleSessionImpl* session) { - DCHECK(sessions_.find(reference_id) == sessions_.end()); - sessions_[reference_id] = session; + DCHECK(sessions_.find(session_id) == sessions_.end()); + sessions_[session_id] = session; } -void ReferenceIdAdapter::RemoveSession(uint32 reference_id) { - DCHECK(sessions_.find(reference_id) != sessions_.end()); - sessions_.erase(reference_id); +void SessionIdAdapter::RemoveSession(uint32 session_id) { + DCHECK(sessions_.find(session_id) != sessions_.end()); + sessions_.erase(session_id); } -void ReferenceIdAdapter::OnSessionCreated(uint32 reference_id, - const std::string& session_id) { - GetSession(reference_id)->OnSessionCreated(session_id); +void SessionIdAdapter::OnSessionCreated(uint32 session_id, + const std::string& web_session_id) { + GetSession(session_id)->OnSessionCreated(web_session_id); } -void ReferenceIdAdapter::OnSessionMessage(uint32 reference_id, - const std::vector<uint8>& message, - const std::string& destination_url) { - GetSession(reference_id)->OnSessionMessage(message, destination_url); +void SessionIdAdapter::OnSessionMessage(uint32 session_id, + const std::vector<uint8>& message, + const std::string& destination_url) { + GetSession(session_id)->OnSessionMessage(message, destination_url); } -void ReferenceIdAdapter::OnSessionReady(uint32 reference_id) { - GetSession(reference_id)->OnSessionReady(); +void SessionIdAdapter::OnSessionReady(uint32 session_id) { + GetSession(session_id)->OnSessionReady(); } -void ReferenceIdAdapter::OnSessionClosed(uint32 reference_id) { - GetSession(reference_id)->OnSessionClosed(); +void SessionIdAdapter::OnSessionClosed(uint32 session_id) { + GetSession(session_id)->OnSessionClosed(); } -void ReferenceIdAdapter::OnSessionError(uint32 reference_id, - media::MediaKeys::KeyError error_code, - int system_code) { - GetSession(reference_id)->OnSessionError(error_code, system_code); +void SessionIdAdapter::OnSessionError(uint32 session_id, + media::MediaKeys::KeyError error_code, + int system_code) { + GetSession(session_id)->OnSessionError(error_code, system_code); } -WebContentDecryptionModuleSessionImpl* ReferenceIdAdapter::GetSession( - uint32 reference_id) { - DCHECK(sessions_.find(reference_id) != sessions_.end()); - return sessions_[reference_id]; +WebContentDecryptionModuleSessionImpl* SessionIdAdapter::GetSession( + uint32 session_id) { + DCHECK(sessions_.find(session_id) != sessions_.end()); + return sessions_[session_id]; } //------------------------------------------------------------------------------ @@ -157,10 +172,10 @@ WebContentDecryptionModuleImpl::Create(const base::string16& key_system) { return NULL; } - // ReferenceIdAdapter creates the MediaKeys so it can provide its callbacks to + // SessionIdAdapter creates the MediaKeys so it can provide its callbacks to // during creation of the MediaKeys. scoped_ptr<media::MediaKeys> media_keys; - scoped_ptr<ReferenceIdAdapter> adapter(new ReferenceIdAdapter()); + scoped_ptr<SessionIdAdapter> adapter(new SessionIdAdapter()); if (!adapter->Initialize(UTF16ToASCII(key_system), &media_keys)) return NULL; @@ -169,7 +184,7 @@ WebContentDecryptionModuleImpl::Create(const base::string16& key_system) { WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( scoped_ptr<media::MediaKeys> media_keys, - scoped_ptr<ReferenceIdAdapter> adapter) + scoped_ptr<SessionIdAdapter> adapter) : media_keys_(media_keys.Pass()), adapter_(adapter.Pass()) { } @@ -182,19 +197,21 @@ blink::WebContentDecryptionModuleSession* WebContentDecryptionModuleImpl::createSession( blink::WebContentDecryptionModuleSession::Client* client) { DCHECK(media_keys_); + uint32 session_id = adapter_->GenerateSessionId(); WebContentDecryptionModuleSessionImpl* session = new WebContentDecryptionModuleSessionImpl( + session_id, media_keys_.get(), client, base::Bind(&WebContentDecryptionModuleImpl::OnSessionClosed, base::Unretained(this))); - adapter_->AddSession(session->reference_id(), session); + adapter_->AddSession(session_id, session); return session; } -void WebContentDecryptionModuleImpl::OnSessionClosed(uint32 reference_id) { - adapter_->RemoveSession(reference_id); +void WebContentDecryptionModuleImpl::OnSessionClosed(uint32 session_id) { + adapter_->RemoveSession(session_id); } } // namespace content diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.h b/content/renderer/media/webcontentdecryptionmodule_impl.h index 27c79c0..ecd5198 100644 --- a/content/renderer/media/webcontentdecryptionmodule_impl.h +++ b/content/renderer/media/webcontentdecryptionmodule_impl.h @@ -18,7 +18,7 @@ class MediaKeys; namespace content { class WebContentDecryptionModuleSessionImpl; -class ReferenceIdAdapter; +class SessionIdAdapter; class WebContentDecryptionModuleImpl : public blink::WebContentDecryptionModule { @@ -35,13 +35,13 @@ class WebContentDecryptionModuleImpl private: // Takes ownership of |media_keys| and |adapter|. WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys, - scoped_ptr<ReferenceIdAdapter> adapter); + scoped_ptr<SessionIdAdapter> adapter); // Called when a WebContentDecryptionModuleSessionImpl is closed. - void OnSessionClosed(uint32 reference_id); + void OnSessionClosed(uint32 session_id); scoped_ptr<media::MediaKeys> media_keys_; - scoped_ptr<ReferenceIdAdapter> adapter_; + scoped_ptr<SessionIdAdapter> adapter_; DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); }; diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc index 6b30469..bc74d35 100644 --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc @@ -11,20 +11,15 @@ namespace content { -static const uint32 kStartingReferenceId = 1; -uint32 WebContentDecryptionModuleSessionImpl::next_reference_id_ = - kStartingReferenceId; -COMPILE_ASSERT(kStartingReferenceId != media::MediaKeys::kInvalidReferenceId, - invalid_starting_value); - WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( + uint32 session_id, media::MediaKeys* media_keys, Client* client, const SessionClosedCB& session_closed_cb) : media_keys_(media_keys), client_(client), session_closed_cb_(session_closed_cb), - reference_id_(next_reference_id_++) { + session_id_(session_id) { DCHECK(media_keys_); } @@ -33,7 +28,7 @@ WebContentDecryptionModuleSessionImpl:: } blink::WebString WebContentDecryptionModuleSessionImpl::sessionId() const { - return blink::WebString::fromUTF8(session_id_); + return web_session_id_; } void WebContentDecryptionModuleSessionImpl::generateKeyRequest( @@ -48,29 +43,30 @@ void WebContentDecryptionModuleSessionImpl::generateKeyRequest( } media_keys_->CreateSession( - reference_id_, UTF16ToASCII(mime_type), init_data, init_data_length); + session_id_, UTF16ToASCII(mime_type), init_data, init_data_length); } void WebContentDecryptionModuleSessionImpl::update(const uint8* response, size_t response_length) { DCHECK(response); - media_keys_->UpdateSession(reference_id_, response, response_length); + media_keys_->UpdateSession(session_id_, response, response_length); } void WebContentDecryptionModuleSessionImpl::close() { - media_keys_->ReleaseSession(reference_id_); + media_keys_->ReleaseSession(session_id_); } void WebContentDecryptionModuleSessionImpl::OnSessionCreated( - const std::string& session_id) { + const std::string& web_session_id) { // Due to heartbeat messages, OnSessionCreated() can get called multiple // times. // TODO(jrummell): Once all CDMs are updated to support reference ids, // OnSessionCreated() should only be called once, and the second check can be // removed. - DCHECK(session_id_.empty() || session_id_ == session_id) + blink::WebString id = blink::WebString::fromUTF8(web_session_id); + DCHECK(web_session_id_.isEmpty() || web_session_id_ == id) << "Session ID may not be changed once set."; - session_id_ = session_id; + web_session_id_ = id; } void WebContentDecryptionModuleSessionImpl::OnSessionMessage( @@ -89,7 +85,7 @@ void WebContentDecryptionModuleSessionImpl::OnSessionReady() { void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { if (!session_closed_cb_.is_null()) - base::ResetAndReturn(&session_closed_cb_).Run(reference_id_); + base::ResetAndReturn(&session_closed_cb_).Run(session_id_); } void WebContentDecryptionModuleSessionImpl::OnSessionError( diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.h b/content/renderer/media/webcontentdecryptionmodulesession_impl.h index 68527d0..6ff091c 100644 --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.h +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.h @@ -23,9 +23,10 @@ namespace content { class WebContentDecryptionModuleSessionImpl : public blink::WebContentDecryptionModuleSession { public: - typedef base::Callback<void(uint32 reference_id)> SessionClosedCB; + typedef base::Callback<void(uint32 session_id)> SessionClosedCB; WebContentDecryptionModuleSessionImpl( + uint32 session_id, media::MediaKeys* media_keys, Client* client, const SessionClosedCB& session_closed_cb); @@ -39,12 +40,8 @@ class WebContentDecryptionModuleSessionImpl virtual void update(const uint8* response, size_t response_length) OVERRIDE; virtual void close() OVERRIDE; - const std::string& session_id() const { return session_id_; } - - uint32 reference_id() const { return reference_id_; } - // Callbacks. - void OnSessionCreated(const std::string& session_id); + void OnSessionCreated(const std::string& web_session_id); void OnSessionMessage(const std::vector<uint8>& message, const std::string& destination_url); void OnSessionReady(); @@ -58,16 +55,13 @@ class WebContentDecryptionModuleSessionImpl SessionClosedCB session_closed_cb_; - // Session ID is the user visible ID for this session generated by the CDM. + // Web session ID is the app visible ID for this session generated by the CDM. // This value is not set until the CDM calls OnSessionCreated(). - std::string session_id_; + blink::WebString web_session_id_; - // Reference ID is used to uniquely track this object so that CDM callbacks + // Session ID is used to uniquely track this object so that CDM callbacks // can get routed to the correct object. - const uint32 reference_id_; - - // Reference ID should be unique per renderer process for debugging purposes. - static uint32 next_reference_id_; + const uint32 session_id_; DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl); }; diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc index 6666f6e..49790db 100644 --- a/content/renderer/pepper/content_decryptor_delegate.cc +++ b/content/renderer/pepper/content_decryptor_delegate.cc @@ -285,7 +285,7 @@ void ContentDecryptorDelegate::SetSessionEventCallbacks( session_error_cb_ = session_error_cb; } -bool ContentDecryptorDelegate::CreateSession(uint32 reference_id, +bool ContentDecryptorDelegate::CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) { @@ -293,27 +293,26 @@ bool ContentDecryptorDelegate::CreateSession(uint32 reference_id, PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( init_data_length, init_data); - plugin_decryption_interface_->CreateSession( - pp_instance_, - reference_id, - StringVar::StringToPPVar(type), - init_data_array); + plugin_decryption_interface_->CreateSession(pp_instance_, + session_id, + StringVar::StringToPPVar(type), + init_data_array); return true; } -bool ContentDecryptorDelegate::UpdateSession(uint32 reference_id, +bool ContentDecryptorDelegate::UpdateSession(uint32 session_id, const uint8* response, int response_length) { PP_Var response_array = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( response_length, response); plugin_decryption_interface_->UpdateSession( - pp_instance_, reference_id, response_array); + pp_instance_, session_id, response_array); return true; } -bool ContentDecryptorDelegate::ReleaseSession(uint32 reference_id) { - plugin_decryption_interface_->ReleaseSession(pp_instance_, reference_id); +bool ContentDecryptorDelegate::ReleaseSession(uint32 session_id) { + plugin_decryption_interface_->ReleaseSession(pp_instance_, session_id); return true; } @@ -590,22 +589,22 @@ bool ContentDecryptorDelegate::DecryptAndDecodeVideo( return true; } -void ContentDecryptorDelegate::OnSessionCreated(uint32 reference_id, - PP_Var session_id_var) { +void ContentDecryptorDelegate::OnSessionCreated(uint32 session_id, + PP_Var web_session_id_var) { if (session_created_cb_.is_null()) return; - StringVar* session_id_string = StringVar::FromPPVar(session_id_var); + StringVar* session_id_string = StringVar::FromPPVar(web_session_id_var); if (!session_id_string) { - OnSessionError(reference_id, media::MediaKeys::kUnknownError, 0); + OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); return; } - session_created_cb_.Run(reference_id, session_id_string->value()); + session_created_cb_.Run(session_id, session_id_string->value()); } -void ContentDecryptorDelegate::OnSessionMessage(uint32 reference_id, +void ContentDecryptorDelegate::OnSessionMessage(uint32 session_id, PP_Var message_var, PP_Var default_url_var) { if (session_message_cb_.is_null()) @@ -622,34 +621,34 @@ void ContentDecryptorDelegate::OnSessionMessage(uint32 reference_id, StringVar* default_url_string = StringVar::FromPPVar(default_url_var); if (!default_url_string) { - OnSessionError(reference_id, media::MediaKeys::kUnknownError, 0); + OnSessionError(session_id, media::MediaKeys::kUnknownError, 0); return; } - session_message_cb_.Run(reference_id, message, default_url_string->value()); + session_message_cb_.Run(session_id, message, default_url_string->value()); } -void ContentDecryptorDelegate::OnSessionReady(uint32 reference_id) { +void ContentDecryptorDelegate::OnSessionReady(uint32 session_id) { if (session_ready_cb_.is_null()) return; - session_ready_cb_.Run(reference_id); + session_ready_cb_.Run(session_id); } -void ContentDecryptorDelegate::OnSessionClosed(uint32 reference_id) { +void ContentDecryptorDelegate::OnSessionClosed(uint32 session_id) { if (session_closed_cb_.is_null()) return; - session_closed_cb_.Run(reference_id); + session_closed_cb_.Run(session_id); } -void ContentDecryptorDelegate::OnSessionError(uint32 reference_id, +void ContentDecryptorDelegate::OnSessionError(uint32 session_id, int32_t media_error, int32_t system_code) { if (session_error_cb_.is_null()) return; - session_error_cb_.Run(reference_id, + session_error_cb_.Run(session_id, static_cast<media::MediaKeys::KeyError>(media_error), system_code); } diff --git a/content/renderer/pepper/content_decryptor_delegate.h b/content/renderer/pepper/content_decryptor_delegate.h index 7e43c2b..352817d 100644 --- a/content/renderer/pepper/content_decryptor_delegate.h +++ b/content/renderer/pepper/content_decryptor_delegate.h @@ -49,14 +49,14 @@ class ContentDecryptorDelegate { const media::SessionErrorCB& session_error_cb); // Provides access to PPP_ContentDecryptor_Private. - bool CreateSession(uint32 reference_id, + bool CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length); - bool UpdateSession(uint32 reference_id, + bool UpdateSession(uint32 session_id, const uint8* response, int response_length); - bool ReleaseSession(uint32 reference_id); + bool ReleaseSession(uint32 session_id); bool Decrypt(media::Decryptor::StreamType stream_type, const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, const media::Decryptor::DecryptCB& decrypt_cb); @@ -80,13 +80,13 @@ class ContentDecryptorDelegate { const media::Decryptor::VideoDecodeCB& video_decode_cb); // PPB_ContentDecryptor_Private dispatching methods. - void OnSessionCreated(uint32 reference_id, PP_Var session_id_var); - void OnSessionMessage(uint32 reference_id, + void OnSessionCreated(uint32 session_id, PP_Var web_session_id_var); + void OnSessionMessage(uint32 session_id, PP_Var message, PP_Var destination_url); - void OnSessionReady(uint32 reference_id); - void OnSessionClosed(uint32 reference_id); - void OnSessionError(uint32 reference_id, + void OnSessionReady(uint32 session_id); + void OnSessionClosed(uint32 session_id); + void OnSessionError(uint32 session_id, int32_t media_error, int32_t system_code); void DeliverBlock(PP_Resource decrypted_block, diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 9e1a29d..1277c63 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -2269,35 +2269,35 @@ PP_Var PepperPluginInstanceImpl::GetDefaultCharSet(PP_Instance instance) { // Therefore, |content_decryptor_delegate_| must have been initialized when // the following methods are called. void PepperPluginInstanceImpl::SessionCreated(PP_Instance instance, - uint32_t reference_id, - PP_Var session_id_var) { - content_decryptor_delegate_->OnSessionCreated(reference_id, session_id_var); + uint32_t session_id, + PP_Var web_session_id_var) { + content_decryptor_delegate_->OnSessionCreated(session_id, web_session_id_var); } void PepperPluginInstanceImpl::SessionMessage(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var message_var, PP_Var destination_url) { content_decryptor_delegate_->OnSessionMessage( - reference_id, message_var, destination_url); + session_id, message_var, destination_url); } void PepperPluginInstanceImpl::SessionReady(PP_Instance instance, - uint32_t reference_id) { - content_decryptor_delegate_->OnSessionReady(reference_id); + uint32_t session_id) { + content_decryptor_delegate_->OnSessionReady(session_id); } void PepperPluginInstanceImpl::SessionClosed(PP_Instance instance, - uint32_t reference_id) { - content_decryptor_delegate_->OnSessionClosed(reference_id); + uint32_t session_id) { + content_decryptor_delegate_->OnSessionClosed(session_id); } void PepperPluginInstanceImpl::SessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code) { content_decryptor_delegate_->OnSessionError( - reference_id, media_error, system_code); + session_id, media_error, system_code); } void PepperPluginInstanceImpl::DeliverBlock( diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index a3a88c8..f000bce 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h @@ -447,18 +447,17 @@ class CONTENT_EXPORT PepperPluginInstanceImpl // PPB_ContentDecryptor_Private implementation. virtual void SessionCreated(PP_Instance instance, - uint32_t reference_id, - PP_Var session_id_var) OVERRIDE; + uint32_t session_id, + PP_Var web_session_id_var) OVERRIDE; virtual void SessionMessage(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var message, PP_Var destination_url) OVERRIDE; - virtual void SessionReady(PP_Instance instance, - uint32_t reference_id) OVERRIDE; + virtual void SessionReady(PP_Instance instance, uint32_t session_id) OVERRIDE; virtual void SessionClosed(PP_Instance instance, - uint32_t reference_id) OVERRIDE; + uint32_t session_id) OVERRIDE; virtual void SessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code) OVERRIDE; virtual void DeliverBlock(PP_Instance instance, diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc index e898816..37eaa33 100644 --- a/media/base/android/media_drm_bridge.cc +++ b/media/base/android/media_drm_bridge.cc @@ -236,7 +236,7 @@ MediaDrmBridge::~MediaDrmBridge() { Java_MediaDrmBridge_release(env, j_media_drm_.obj()); } -bool MediaDrmBridge::CreateSession(uint32 reference_id, +bool MediaDrmBridge::CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) { @@ -248,13 +248,13 @@ bool MediaDrmBridge::CreateSession(uint32 reference_id, ScopedJavaLocalRef<jbyteArray> j_pssh_data = base::android::ToJavaByteArray(env, &pssh_data[0], pssh_data.size()); ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, type); - pending_key_request_reference_ids_.push(reference_id); + pending_key_request_session_ids_.push(session_id); Java_MediaDrmBridge_generateKeyRequest( env, j_media_drm_.obj(), j_pssh_data.obj(), j_mime.obj()); return true; } -void MediaDrmBridge::UpdateSession(uint32 reference_id, +void MediaDrmBridge::UpdateSession(uint32 session_id, const uint8* response, int response_length) { DVLOG(1) << __FUNCTION__; @@ -262,16 +262,16 @@ void MediaDrmBridge::UpdateSession(uint32 reference_id, ScopedJavaLocalRef<jbyteArray> j_response = base::android::ToJavaByteArray(env, response, response_length); ScopedJavaLocalRef<jstring> j_session_id = - ConvertUTF8ToJavaString(env, LookupSessionId(reference_id)); + ConvertUTF8ToJavaString(env, LookupWebSessionId(session_id)); // TODO(jrummell): Update Android names to match new functionality. Java_MediaDrmBridge_addKey( env, j_media_drm_.obj(), j_session_id.obj(), j_response.obj()); } -void MediaDrmBridge::ReleaseSession(uint32 reference_id) { +void MediaDrmBridge::ReleaseSession(uint32 session_id) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jstring> j_session_id = - ConvertUTF8ToJavaString(env, LookupSessionId(reference_id)); + ConvertUTF8ToJavaString(env, LookupWebSessionId(session_id)); Java_MediaDrmBridge_cancelKeyRequest( env, j_media_drm_.obj(), j_session_id.obj()); } @@ -303,29 +303,29 @@ void MediaDrmBridge::OnKeyMessage(JNIEnv* env, jstring j_session_id, jbyteArray j_message, jstring j_destination_url) { - std::string session_id = ConvertJavaStringToUTF8(env, j_session_id); - uint32_t reference_id = DetermineReferenceId(session_id); + std::string web_session_id = ConvertJavaStringToUTF8(env, j_session_id); + uint32_t session_id = LookupSessionId(web_session_id); std::vector<uint8> message; JavaByteArrayToByteVector(env, j_message, &message); std::string destination_url = ConvertJavaStringToUTF8(env, j_destination_url); - manager_->OnSessionCreated(media_keys_id_, reference_id, session_id); + manager_->OnSessionCreated(media_keys_id_, session_id, web_session_id); manager_->OnSessionMessage( - media_keys_id_, reference_id, message, destination_url); + media_keys_id_, session_id, message, destination_url); } void MediaDrmBridge::OnKeyAdded(JNIEnv* env, jobject, jstring j_session_id) { - std::string session_id = ConvertJavaStringToUTF8(env, j_session_id); - uint32_t reference_id = DetermineReferenceId(session_id); - manager_->OnSessionReady(media_keys_id_, reference_id); + std::string web_session_id = ConvertJavaStringToUTF8(env, j_session_id); + uint32_t session_id = LookupSessionId(web_session_id); + manager_->OnSessionReady(media_keys_id_, session_id); } void MediaDrmBridge::OnKeyError(JNIEnv* env, jobject, jstring j_session_id) { // |j_session_id| can be NULL, in which case we'll return an empty string. - std::string session_id = ConvertJavaStringToUTF8(env, j_session_id); - uint32 reference_id = DetermineReferenceId(session_id); + std::string web_session_id = ConvertJavaStringToUTF8(env, j_session_id); + uint32 session_id = LookupSessionId(web_session_id); manager_->OnSessionError( - media_keys_id_, reference_id, MediaKeys::kUnknownError, 0); + media_keys_id_, session_id, MediaKeys::kUnknownError, 0); } ScopedJavaLocalRef<jobject> MediaDrmBridge::GetMediaCrypto() { @@ -364,7 +364,7 @@ void MediaDrmBridge::OnResetDeviceCredentialsCompleted( base::ResetAndReturn(&reset_credentials_cb_).Run(success); } -uint32_t MediaDrmBridge::DetermineReferenceId(const std::string& session_id) { +uint32_t MediaDrmBridge::LookupSessionId(const std::string& session_id) { for (SessionMap::iterator it = session_map_.begin(); it != session_map_.end(); ++it) { @@ -374,25 +374,24 @@ uint32_t MediaDrmBridge::DetermineReferenceId(const std::string& session_id) { // There is no entry in the map; assume it came from the oldest // GenerateKeyRequest() call. - DCHECK(!pending_key_request_reference_ids_.empty()); - uint32 reference_id = pending_key_request_reference_ids_.front(); - pending_key_request_reference_ids_.pop(); + DCHECK(!pending_key_request_session_ids_.empty()); + uint32 session_reference_id = pending_key_request_session_ids_.front(); + pending_key_request_session_ids_.pop(); // If this is a valid |session_id|, add it to the list. Otherwise, avoid // adding empty string as a mapping to prevent future calls with an empty - // string from using the wrong reference_id. + // string from using the wrong session_reference_id. if (!session_id.empty()) { - DCHECK(session_map_.find(reference_id) == session_map_.end()); - DCHECK(!session_id.empty()); - session_map_[reference_id] = session_id; + DCHECK(session_map_.find(session_reference_id) == session_map_.end()); + session_map_[session_reference_id] = session_id; } - return reference_id; + return session_reference_id; } -const std::string& MediaDrmBridge::LookupSessionId(uint32 reference_id) { +const std::string& MediaDrmBridge::LookupWebSessionId(uint32 session_id) { // Session may not exist if error happens during GenerateKeyRequest(). - SessionMap::iterator it = session_map_.find(reference_id); + SessionMap::iterator it = session_map_.find(session_id); return (it != session_map_.end()) ? it->second : base::EmptyString(); } diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h index 7581291..9a5f693 100644 --- a/media/base/android/media_drm_bridge.h +++ b/media/base/android/media_drm_bridge.h @@ -61,14 +61,14 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { static bool RegisterMediaDrmBridge(JNIEnv* env); // MediaKeys implementations. - virtual bool CreateSession(uint32 reference_id, + virtual bool CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) OVERRIDE; - virtual void UpdateSession(uint32 reference_id, + virtual void UpdateSession(uint32 session_id, const uint8* response, int response_length) OVERRIDE; - virtual void ReleaseSession(uint32 reference_id) OVERRIDE; + virtual void ReleaseSession(uint32 session_id) OVERRIDE; // Returns a MediaCrypto object if it's already created. Returns a null object // otherwise. @@ -106,7 +106,7 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { GURL frame_url() const { return frame_url_; } private: - // Map between session_id and reference_id. + // Map between session_id and web_session_id. typedef std::map<uint32_t, std::string> SessionMap; static bool IsSecureDecoderRequired(SecurityLevel security_level); @@ -120,12 +120,12 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { // Get the security level of the media. SecurityLevel GetSecurityLevel(); - // Determine the corresponding reference_id for |session_id|. - uint32_t DetermineReferenceId(const std::string& session_id); + // Determine the corresponding session_id for |web_session_id|. + uint32_t LookupSessionId(const std::string& web_session_id); - // Determine the corresponding session_id for |reference_id|. The returned + // Determine the corresponding web_session_id for |session_id|. The returned // value is only valid on the main thread, and should be stored by copy. - const std::string& LookupSessionId(uint32_t reference_id); + const std::string& LookupWebSessionId(uint32_t session_id); // ID of the MediaKeys object. int media_keys_id_; @@ -151,8 +151,8 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys { // As the response from GenerateKeyRequest() will be asynchronous, add this // request to a queue and assume that the subsequent responses come back in // the order issued. - // TODO(jrummell): Remove once the Java interface supports reference_id. - std::queue<uint32_t> pending_key_request_reference_ids_; + // TODO(jrummell): Remove once the Java interface supports session_id. + std::queue<uint32_t> pending_key_request_session_ids_; DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); }; diff --git a/media/base/android/media_player_manager.h b/media/base/android/media_player_manager.h index ce4a196..c215df5 100644 --- a/media/base/android/media_player_manager.h +++ b/media/base/android/media_player_manager.h @@ -94,24 +94,24 @@ class MEDIA_EXPORT MediaPlayerManager { // Called when MediaDrmBridge determines a SessionId. virtual void OnSessionCreated(int media_keys_id, - uint32 reference_id, - const std::string& session_id) = 0; + uint32 session_id, + const std::string& web_session_id) = 0; // Called when MediaDrmBridge wants to send a Message event. virtual void OnSessionMessage(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) = 0; // Called when MediaDrmBridge wants to send a Ready event. - virtual void OnSessionReady(int media_keys_id, uint32 reference_id) = 0; + virtual void OnSessionReady(int media_keys_id, uint32 session_id) = 0; // Called when MediaDrmBridge wants to send a Closed event. - virtual void OnSessionClosed(int media_keys_id, uint32 reference_id) = 0; + virtual void OnSessionClosed(int media_keys_id, uint32 session_id) = 0; // Called when MediaDrmBridge wants to send an Error event. virtual void OnSessionError(int media_keys_id, - uint32 reference_id, + uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) = 0; }; diff --git a/media/base/android/media_source_player_unittest.cc b/media/base/android/media_source_player_unittest.cc index 1da6641..6b3a66c 100644 --- a/media/base/android/media_source_player_unittest.cc +++ b/media/base/android/media_source_player_unittest.cc @@ -74,18 +74,16 @@ class MockMediaPlayerManager : public MediaPlayerManager { } virtual void OnProtectedSurfaceRequested(int player_id) OVERRIDE {} virtual void OnSessionCreated(int media_keys_id, - uint32 reference_id, - const std::string& session_id) OVERRIDE {} + uint32 session_id, + const std::string& web_session_id) OVERRIDE {} virtual void OnSessionMessage(int media_keys_id, - uint32 reference_id, + uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) OVERRIDE {} - virtual void OnSessionReady(int media_keys_id, - uint32 reference_id) OVERRIDE {} - virtual void OnSessionClosed(int media_keys_id, - uint32 reference_id) OVERRIDE {} + virtual void OnSessionReady(int media_keys_id, uint32 session_id) OVERRIDE {} + virtual void OnSessionClosed(int media_keys_id, uint32 session_id) OVERRIDE {} virtual void OnSessionError(int media_keys_id, - uint32 reference_id, + uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) OVERRIDE {} diff --git a/media/base/media_keys.h b/media/base/media_keys.h index a17fc85..0d86948 100644 --- a/media/base/media_keys.h +++ b/media/base/media_keys.h @@ -37,7 +37,7 @@ class MEDIA_EXPORT MediaKeys { kMaxKeyError // Must be last and greater than any legit value. }; - const static uint32 kInvalidReferenceId = 0; + const static uint32 kInvalidSessionId = 0; MediaKeys(); virtual ~MediaKeys(); @@ -47,18 +47,18 @@ class MEDIA_EXPORT MediaKeys { // Note: UpdateSession() and ReleaseSession() should only be called after // CreateSession() returns true. // TODO(jrummell): Remove return value when prefixed API is removed. - virtual bool CreateSession(uint32 reference_id, + virtual bool CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) = 0; - // Updates a session specified by |reference_id| with |response|. - virtual void UpdateSession(uint32 reference_id, + // Updates a session specified by |session_id| with |response|. + virtual void UpdateSession(uint32 session_id, const uint8* response, int response_length) = 0; - // Releases the session specified by |reference_id|. - virtual void ReleaseSession(uint32 reference_id) = 0; + // Releases the session specified by |session_id|. + virtual void ReleaseSession(uint32 session_id) = 0; // Gets the Decryptor object associated with the MediaKeys. Returns NULL if // no Decryptor object is associated. The returned object is only guaranteed @@ -71,19 +71,20 @@ class MEDIA_EXPORT MediaKeys { // Key event callbacks. See the spec for details: // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html#event-summary -typedef base::Callback<void(uint32 reference_id, const std::string& session_id)> +typedef base::Callback< + void(uint32 session_id, const std::string& web_session_id)> SessionCreatedCB; -typedef base::Callback<void(uint32 reference_id, +typedef base::Callback<void(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url)> SessionMessageCB; -typedef base::Callback<void(uint32 reference_id)> SessionReadyCB; +typedef base::Callback<void(uint32 session_id)> SessionReadyCB; -typedef base::Callback<void(uint32 reference_id)> SessionClosedCB; +typedef base::Callback<void(uint32 session_id)> SessionClosedCB; -typedef base::Callback<void(uint32 reference_id, +typedef base::Callback<void(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code)> SessionErrorCB; diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc index ee4b987..bdcc27e 100644 --- a/media/cdm/aes_decryptor.cc +++ b/media/cdm/aes_decryptor.cc @@ -20,7 +20,7 @@ namespace media { -uint32 AesDecryptor::next_session_id_ = 1; +uint32 AesDecryptor::next_web_session_id_ = 1; enum ClearBytesBufferSel { kSrcContainsClearBytes, @@ -157,11 +157,11 @@ AesDecryptor::~AesDecryptor() { STLDeleteValues(&key_map_); } -bool AesDecryptor::CreateSession(uint32 reference_id, +bool AesDecryptor::CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) { - std::string session_id_string(base::UintToString(next_session_id_++)); + std::string web_session_id_string(base::UintToString(next_web_session_id_++)); // For now, the AesDecryptor does not care about |type|; // just fire the event with the |init_data| as the request. @@ -169,12 +169,12 @@ bool AesDecryptor::CreateSession(uint32 reference_id, if (init_data && init_data_length) message.assign(init_data, init_data + init_data_length); - session_created_cb_.Run(reference_id, session_id_string); - session_message_cb_.Run(reference_id, message, std::string()); + session_created_cb_.Run(session_id, web_session_id_string); + session_message_cb_.Run(session_id, message, std::string()); return true; } -void AesDecryptor::UpdateSession(uint32 reference_id, +void AesDecryptor::UpdateSession(uint32 session_id, const uint8* response, int response_length) { CHECK(response); @@ -184,13 +184,13 @@ void AesDecryptor::UpdateSession(uint32 reference_id, response_length); KeyIdAndKeyPairs keys; if (!ExtractKeysFromJWKSet(key_string, &keys)) { - session_error_cb_.Run(reference_id, MediaKeys::kUnknownError, 0); + session_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0); return; } // Make sure that at least one key was extracted. if (keys.empty()) { - session_error_cb_.Run(reference_id, MediaKeys::kUnknownError, 0); + session_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0); return; } @@ -198,11 +198,11 @@ void AesDecryptor::UpdateSession(uint32 reference_id, if (it->second.length() != static_cast<size_t>(DecryptConfig::kDecryptionKeySize)) { DVLOG(1) << "Invalid key length: " << key_string.length(); - session_error_cb_.Run(reference_id, MediaKeys::kUnknownError, 0); + session_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0); return; } if (!AddDecryptionKey(it->first, it->second)) { - session_error_cb_.Run(reference_id, MediaKeys::kUnknownError, 0); + session_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0); return; } } @@ -213,10 +213,10 @@ void AesDecryptor::UpdateSession(uint32 reference_id, if (!new_video_key_cb_.is_null()) new_video_key_cb_.Run(); - session_ready_cb_.Run(reference_id); + session_ready_cb_.Run(session_id); } -void AesDecryptor::ReleaseSession(uint32 reference_id) { +void AesDecryptor::ReleaseSession(uint32 session_id) { // TODO: Implement: http://crbug.com/313412. } diff --git a/media/cdm/aes_decryptor.h b/media/cdm/aes_decryptor.h index 8e03106..35b1488 100644 --- a/media/cdm/aes_decryptor.h +++ b/media/cdm/aes_decryptor.h @@ -35,14 +35,14 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor { virtual ~AesDecryptor(); // MediaKeys implementation. - virtual bool CreateSession(uint32 reference_id, + virtual bool CreateSession(uint32 session_id, const std::string& type, const uint8* init_data, int init_data_length) OVERRIDE; - virtual void UpdateSession(uint32 reference_id, + virtual void UpdateSession(uint32 session_id, const uint8* response, int response_length) OVERRIDE; - virtual void ReleaseSession(uint32 reference_id) OVERRIDE; + virtual void ReleaseSession(uint32 session_id) OVERRIDE; virtual Decryptor* GetDecryptor() OVERRIDE; // Decryptor implementation. @@ -115,10 +115,9 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor { KeyMap key_map_; // Protected by the |key_map_lock_|. mutable base::Lock key_map_lock_; // Protects the |key_map_|. - // Make session ID unique per renderer by making it static. - // TODO(xhwang): Make session ID more strictly defined if needed: - // https://www.w3.org/Bugs/Public/show_bug.cgi?id=16739#c0 - static uint32 next_session_id_; + // Make web session ID unique per renderer by making it static. Web session + // IDs seen by the app will be "1", "2", etc. + static uint32 next_web_session_id_; NewKeyCB new_audio_key_cb_; NewKeyCB new_video_key_cb_; diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc index cd0d460..53c7f1a8 100644 --- a/media/cdm/aes_decryptor_unittest.cc +++ b/media/cdm/aes_decryptor_unittest.cc @@ -195,7 +195,7 @@ class AesDecryptorTest : public testing::Test { base::Unretained(this)), base::Bind(&AesDecryptorTest::OnSessionError, base::Unretained(this))), - reference_id_(MediaKeys::kInvalidReferenceId), + session_id_(MediaKeys::kInvalidSessionId), decrypt_cb_(base::Bind(&AesDecryptorTest::BufferDecrypted, base::Unretained(this))), original_data_(kOriginalData, kOriginalData + kOriginalDataSize), @@ -213,12 +213,12 @@ class AesDecryptorTest : public testing::Test { protected: void CreateSession(const std::vector<uint8>& key_id) { - reference_id_ = 6; + session_id_ = 6; DCHECK(!key_id.empty()); - EXPECT_CALL(*this, OnSessionCreated(reference_id_, StrNe(std::string()))); - EXPECT_CALL(*this, OnSessionMessage(reference_id_, key_id, "")); + EXPECT_CALL(*this, OnSessionCreated(session_id_, StrNe(std::string()))); + EXPECT_CALL(*this, OnSessionMessage(session_id_, key_id, "")); EXPECT_TRUE(decryptor_.CreateSession( - reference_id_, std::string(), &key_id[0], key_id.size())); + session_id_, std::string(), &key_id[0], key_id.size())); } enum AddKeyExpectation { @@ -230,17 +230,16 @@ class AesDecryptorTest : public testing::Test { DCHECK(!key.empty()); if (result == KEY_ADDED) { - EXPECT_CALL(*this, OnSessionReady(reference_id_)); + EXPECT_CALL(*this, OnSessionReady(session_id_)); } else if (result == KEY_ERROR) { EXPECT_CALL(*this, - OnSessionError(reference_id_, MediaKeys::kUnknownError, 0)); + OnSessionError(session_id_, MediaKeys::kUnknownError, 0)); } else { NOTREACHED(); } - decryptor_.UpdateSession(reference_id_, - reinterpret_cast<const uint8*>(key.c_str()), - key.length()); + decryptor_.UpdateSession( + session_id_, reinterpret_cast<const uint8*>(key.c_str()), key.length()); } MOCK_METHOD2(BufferDecrypted, void(Decryptor::Status, @@ -292,18 +291,18 @@ class AesDecryptorTest : public testing::Test { } MOCK_METHOD2(OnSessionCreated, - void(uint32 reference_id, const std::string& session_id)); + void(uint32 session_id, const std::string& web_session_id)); MOCK_METHOD3(OnSessionMessage, - void(uint32 reference_id, + void(uint32 session_id, const std::vector<uint8>& message, const std::string& default_url)); - MOCK_METHOD1(OnSessionReady, void(uint32 reference_id)); - MOCK_METHOD1(OnSessionClosed, void(uint32 reference_id)); + MOCK_METHOD1(OnSessionReady, void(uint32 session_id)); + MOCK_METHOD1(OnSessionClosed, void(uint32 session_id)); MOCK_METHOD3(OnSessionError, - void(uint32 reference_id, MediaKeys::KeyError, int system_code)); + void(uint32 session_id, MediaKeys::KeyError, int system_code)); AesDecryptor decryptor_; - uint32 reference_id_; + uint32 session_id_; AesDecryptor::DecryptCB decrypt_cb_; // Constants for testing. @@ -317,27 +316,27 @@ class AesDecryptorTest : public testing::Test { }; TEST_F(AesDecryptorTest, CreateSessionWithNullInitData) { - reference_id_ = 8; - EXPECT_CALL(*this, OnSessionMessage(reference_id_, IsEmpty(), "")); - EXPECT_CALL(*this, OnSessionCreated(reference_id_, StrNe(std::string()))); - EXPECT_TRUE(decryptor_.CreateSession(reference_id_, std::string(), NULL, 0)); + session_id_ = 8; + EXPECT_CALL(*this, OnSessionMessage(session_id_, IsEmpty(), "")); + EXPECT_CALL(*this, OnSessionCreated(session_id_, StrNe(std::string()))); + EXPECT_TRUE(decryptor_.CreateSession(session_id_, std::string(), NULL, 0)); } TEST_F(AesDecryptorTest, MultipleCreateSession) { - uint32 reference_id1 = 10; - EXPECT_CALL(*this, OnSessionMessage(reference_id1, IsEmpty(), "")); - EXPECT_CALL(*this, OnSessionCreated(reference_id1, StrNe(std::string()))); - EXPECT_TRUE(decryptor_.CreateSession(reference_id1, std::string(), NULL, 0)); - - uint32 reference_id2 = 11; - EXPECT_CALL(*this, OnSessionMessage(reference_id2, IsEmpty(), "")); - EXPECT_CALL(*this, OnSessionCreated(reference_id2, StrNe(std::string()))); - EXPECT_TRUE(decryptor_.CreateSession(reference_id2, std::string(), NULL, 0)); - - uint32 reference_id3 = 23; - EXPECT_CALL(*this, OnSessionMessage(reference_id3, IsEmpty(), "")); - EXPECT_CALL(*this, OnSessionCreated(reference_id3, StrNe(std::string()))); - EXPECT_TRUE(decryptor_.CreateSession(reference_id3, std::string(), NULL, 0)); + uint32 session_id1 = 10; + EXPECT_CALL(*this, OnSessionMessage(session_id1, IsEmpty(), "")); + EXPECT_CALL(*this, OnSessionCreated(session_id1, StrNe(std::string()))); + EXPECT_TRUE(decryptor_.CreateSession(session_id1, std::string(), NULL, 0)); + + uint32 session_id2 = 11; + EXPECT_CALL(*this, OnSessionMessage(session_id2, IsEmpty(), "")); + EXPECT_CALL(*this, OnSessionCreated(session_id2, StrNe(std::string()))); + EXPECT_TRUE(decryptor_.CreateSession(session_id2, std::string(), NULL, 0)); + + uint32 session_id3 = 23; + EXPECT_CALL(*this, OnSessionMessage(session_id3, IsEmpty(), "")); + EXPECT_CALL(*this, OnSessionCreated(session_id3, StrNe(std::string()))); + EXPECT_TRUE(decryptor_.CreateSession(session_id3, std::string(), NULL, 0)); } TEST_F(AesDecryptorTest, NormalDecryption) { diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc index 489eb1d..209335b 100644 --- a/media/cdm/ppapi/cdm_adapter.cc +++ b/media/cdm/ppapi/cdm_adapter.cc @@ -247,13 +247,13 @@ void CdmAdapter::Initialize(const std::string& key_system) { key_system_ = key_system; } -void CdmAdapter::CreateSession(uint32_t reference_id, +void CdmAdapter::CreateSession(uint32_t session_id, const std::string& type, pp::VarArrayBuffer init_data) { // Initialize() doesn't report an error, so CreateSession() can be called // even if Initialize() failed. if (!cdm_) { - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); return; } @@ -261,7 +261,7 @@ void CdmAdapter::CreateSession(uint32_t reference_id, PP_URLComponents_Dev url_components = {}; const pp::URLUtil_Dev* url_util = pp::URLUtil_Dev::Get(); if (!url_util) { - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); return; } pp::Var href = url_util->GetDocumentURL( @@ -272,19 +272,19 @@ void CdmAdapter::CreateSession(uint32_t reference_id, PP_DCHECK(0 < url_components.host.len); #endif // defined(CHECK_DOCUMENT_URL) - cdm_->CreateSession(reference_id, + cdm_->CreateSession(session_id, type.data(), type.size(), static_cast<const uint8_t*>(init_data.Map()), init_data.ByteLength()); } -void CdmAdapter::UpdateSession(uint32_t reference_id, +void CdmAdapter::UpdateSession(uint32_t session_id, pp::VarArrayBuffer response) { // TODO(jrummell): In EME WD, AddKey() can only be called on valid sessions. // We should be able to DCHECK(cdm_) when addressing http://crbug.com/249976. if (!cdm_) { - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); return; } @@ -292,32 +292,32 @@ void CdmAdapter::UpdateSession(uint32_t reference_id, const uint32_t response_size = response.ByteLength(); if (!response_ptr || response_size <= 0) { - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); return; } CdmWrapper::Result result = - cdm_->UpdateSession(reference_id, response_ptr, response_size); + cdm_->UpdateSession(session_id, response_ptr, response_size); switch (result) { case CdmWrapper::NO_ACTION: break; case CdmWrapper::CALL_KEY_ADDED: - OnSessionReady(reference_id); + OnSessionReady(session_id); break; case CdmWrapper::CALL_KEY_ERROR: - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); break; } } -void CdmAdapter::ReleaseSession(uint32_t reference_id) { +void CdmAdapter::ReleaseSession(uint32_t session_id) { // TODO(jrummell): In EME WD, AddKey() can only be called on valid sessions. // We should be able to DCHECK(cdm_) when addressing http://crbug.com/249976. if (!cdm_) { - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); return; } - CdmWrapper::Result result = cdm_->ReleaseSession(reference_id); + CdmWrapper::Result result = cdm_->ReleaseSession(session_id); switch (result) { case CdmWrapper::NO_ACTION: break; @@ -325,7 +325,7 @@ void CdmAdapter::ReleaseSession(uint32_t reference_id) { PP_NOTREACHED(); break; case CdmWrapper::CALL_KEY_ERROR: - OnSessionError(reference_id, cdm::kUnknownError, 0); + OnSessionError(session_id, cdm::kUnknownError, 0); break; } } @@ -536,11 +536,12 @@ void CdmAdapter::SendKeyMessage( std::string session_id_str(session_id, session_id_length); PP_DCHECK(!session_id_str.empty()); - uint32_t reference_id = cdm_->DetermineReferenceId(session_id_str); + uint32_t session_reference_id = cdm_->LookupSessionId(session_id_str); - OnSessionCreated(reference_id, session_id, session_id_length); - OnSessionMessage( - reference_id, message, message_length, default_url, default_url_length); + OnSessionCreated(session_reference_id, session_id, session_id_length); + OnSessionMessage(session_reference_id, + message, message_length, + default_url, default_url_length); } void CdmAdapter::SendKeyError(const char* session_id, @@ -548,8 +549,8 @@ void CdmAdapter::SendKeyError(const char* session_id, cdm::MediaKeyError error_code, uint32_t system_code) { std::string session_id_str(session_id, session_id_length); - uint32_t reference_id = cdm_->DetermineReferenceId(session_id_str); - OnSessionError(reference_id, error_code, system_code); + uint32_t session_reference_id = cdm_->LookupSessionId(session_id_str); + OnSessionError(session_reference_id, error_code, system_code); } void CdmAdapter::GetPrivateData(int32_t* instance, @@ -558,56 +559,56 @@ void CdmAdapter::GetPrivateData(int32_t* instance, *get_interface = pp::Module::Get()->get_browser_interface(); } -void CdmAdapter::OnSessionCreated(uint32_t reference_id, - const char* session_id, - uint32_t session_id_length) { +void CdmAdapter::OnSessionCreated(uint32_t session_id, + const char* web_session_id, + uint32_t web_session_id_length) { PostOnMain(callback_factory_.NewCallback( &CdmAdapter::SendSessionCreatedInternal, - reference_id, - std::string(session_id, session_id_length))); + session_id, + std::string(web_session_id, web_session_id_length))); } -void CdmAdapter::OnSessionMessage(uint32_t reference_id, +void CdmAdapter::OnSessionMessage(uint32_t session_id, const char* message, uint32_t message_length, const char* destination_url, uint32_t destination_url_length) { PostOnMain(callback_factory_.NewCallback( &CdmAdapter::SendSessionMessageInternal, - reference_id, + session_id, std::vector<uint8>(message, message + message_length), std::string(destination_url, destination_url_length))); } -void CdmAdapter::OnSessionReady(uint32_t reference_id) { +void CdmAdapter::OnSessionReady(uint32_t session_id) { PostOnMain(callback_factory_.NewCallback( - &CdmAdapter::SendSessionReadyInternal, reference_id)); + &CdmAdapter::SendSessionReadyInternal, session_id)); } -void CdmAdapter::OnSessionClosed(uint32_t reference_id) { +void CdmAdapter::OnSessionClosed(uint32_t session_id) { PostOnMain(callback_factory_.NewCallback( - &CdmAdapter::SendSessionClosedInternal, reference_id)); + &CdmAdapter::SendSessionClosedInternal, session_id)); } -void CdmAdapter::OnSessionError(uint32_t reference_id, +void CdmAdapter::OnSessionError(uint32_t session_id, cdm::MediaKeyError error_code, uint32_t system_code) { PostOnMain(callback_factory_.NewCallback( &CdmAdapter::SendSessionErrorInternal, - reference_id, + session_id, error_code, system_code)); } void CdmAdapter::SendSessionCreatedInternal(int32_t result, - uint32_t reference_id, - const std::string& session_id) { + uint32_t session_id, + const std::string& web_session_id) { PP_DCHECK(result == PP_OK); - pp::ContentDecryptor_Private::SessionCreated(reference_id, session_id); + pp::ContentDecryptor_Private::SessionCreated(session_id, web_session_id); } void CdmAdapter::SendSessionMessageInternal(int32_t result, - uint32_t reference_id, + uint32_t session_id, const std::vector<uint8>& message, const std::string& default_url) { PP_DCHECK(result == PP_OK); @@ -618,28 +619,27 @@ void CdmAdapter::SendSessionMessageInternal(int32_t result, } pp::ContentDecryptor_Private::SessionMessage( - reference_id, message_array_buffer, default_url); + session_id, message_array_buffer, default_url); } -void CdmAdapter::SendSessionReadyInternal(int32_t result, - uint32_t reference_id) { +void CdmAdapter::SendSessionReadyInternal(int32_t result, uint32_t session_id) { PP_DCHECK(result == PP_OK); - pp::ContentDecryptor_Private::SessionReady(reference_id); + pp::ContentDecryptor_Private::SessionReady(session_id); } void CdmAdapter::SendSessionClosedInternal(int32_t result, - uint32_t reference_id) { + uint32_t session_id) { PP_DCHECK(result == PP_OK); - pp::ContentDecryptor_Private::SessionClosed(reference_id); + pp::ContentDecryptor_Private::SessionClosed(session_id); } void CdmAdapter::SendSessionErrorInternal(int32_t result, - uint32_t reference_id, + uint32_t session_id, cdm::MediaKeyError error_code, uint32_t system_code) { PP_DCHECK(result == PP_OK); pp::ContentDecryptor_Private::SessionError( - reference_id, error_code, system_code); + session_id, error_code, system_code); } void CdmAdapter::DeliverBlock(int32_t result, diff --git a/media/cdm/ppapi/cdm_adapter.h b/media/cdm/ppapi/cdm_adapter.h index 57e7524..ec7145d 100644 --- a/media/cdm/ppapi/cdm_adapter.h +++ b/media/cdm/ppapi/cdm_adapter.h @@ -53,12 +53,12 @@ class CdmAdapter : public pp::Instance, // Note: Results of calls to these methods must be reported through the // PPB_ContentDecryptor_Private interface. virtual void Initialize(const std::string& key_system) OVERRIDE; - virtual void CreateSession(uint32_t reference_id, + virtual void CreateSession(uint32_t session_id, const std::string& type, pp::VarArrayBuffer init_data) OVERRIDE; - virtual void UpdateSession(uint32_t reference_id, + virtual void UpdateSession(uint32_t session_id, pp::VarArrayBuffer response) OVERRIDE; - virtual void ReleaseSession(uint32_t reference_id) OVERRIDE; + virtual void ReleaseSession(uint32_t session_id) OVERRIDE; virtual void Decrypt( pp::Buffer_Dev encrypted_buffer, const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE; @@ -104,17 +104,17 @@ class CdmAdapter : public pp::Instance, cdm::Status decoder_status) OVERRIDE; // cdm::Host_3 implementation. - virtual void OnSessionCreated(uint32_t reference_id, - const char* session_id, - uint32_t session_id_length) OVERRIDE; - virtual void OnSessionMessage(uint32_t reference_id, + virtual void OnSessionCreated(uint32_t session_id, + const char* web_session_id, + uint32_t web_session_id_length) OVERRIDE; + virtual void OnSessionMessage(uint32_t session_id, const char* message, uint32_t message_length, const char* destination_url, uint32_t destination_url_length) OVERRIDE; - virtual void OnSessionReady(uint32_t reference_id) OVERRIDE; - virtual void OnSessionClosed(uint32_t reference_id) OVERRIDE; - virtual void OnSessionError(uint32_t reference_id, + virtual void OnSessionReady(uint32_t session_id) OVERRIDE; + virtual void OnSessionClosed(uint32_t session_id) OVERRIDE; + virtual void OnSessionError(uint32_t session_id, cdm::MediaKeyError error_code, uint32_t system_code) OVERRIDE; @@ -129,16 +129,16 @@ class CdmAdapter : public pp::Instance, // <code>callback_factory_</code> to ensure that calls into // <code>PPP_ContentDecryptor_Private</code> are asynchronous. void SendSessionCreatedInternal(int32_t result, - uint32_t reference_id, - const std::string& session_id); + uint32_t session_id, + const std::string& web_session_id); void SendSessionMessageInternal(int32_t result, - uint32_t reference_id, + uint32_t session_id, const std::vector<uint8>& message, const std::string& default_url); - void SendSessionReadyInternal(int32_t result, uint32_t reference_id); - void SendSessionClosedInternal(int32_t result, uint32_t reference_id); + void SendSessionReadyInternal(int32_t result, uint32_t session_id); + void SendSessionClosedInternal(int32_t result, uint32_t session_id); void SendSessionErrorInternal(int32_t result, - uint32_t reference_id, + uint32_t session_id, cdm::MediaKeyError error_code, uint32_t system_code); diff --git a/media/cdm/ppapi/cdm_wrapper.h b/media/cdm/ppapi/cdm_wrapper.h index 63d8bbf..d827336 100644 --- a/media/cdm/ppapi/cdm_wrapper.h +++ b/media/cdm/ppapi/cdm_wrapper.h @@ -52,15 +52,15 @@ class CdmWrapper { virtual ~CdmWrapper() {}; - virtual void CreateSession(uint32_t reference_id, + virtual void CreateSession(uint32_t session_id, const char* type, uint32_t type_size, const uint8_t* init_data, uint32_t init_data_size) = 0; - virtual Result UpdateSession(uint32_t reference_id, + virtual Result UpdateSession(uint32_t session_id, const uint8_t* response, uint32_t response_size) = 0; - virtual Result ReleaseSession(uint32_t reference_id) = 0; + virtual Result ReleaseSession(uint32_t session_id) = 0; virtual void TimerExpired(void* context) = 0; virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, cdm::DecryptedBlock* decrypted_buffer) = 0; @@ -84,40 +84,40 @@ class CdmWrapper { // ContentDecryptionModule_1 and ContentDecryptionModule_2 interface methods // AddKey() and CancelKeyRequest() (older versions of UpdateSession() and - // ReleaseSession(), respectively) pass in the session_id rather than the - // reference_id. As well, Host_1 and Host_2 callbacks SendKeyMessage() and - // SendKeyError() include the session ID, but the actual callbacks need the - // reference ID. + // ReleaseSession(), respectively) pass in the web_session_id rather than the + // session_id. As well, Host_1 and Host_2 callbacks SendKeyMessage() and + // SendKeyError() include the web_session_id, but the actual callbacks need + // session_id. // - // The following functions maintain the reference_id <-> session_id mapping. + // The following functions maintain the session_id <-> web_session_id mapping. // These can be removed once _1 and _2 interfaces are no longer supported. - // Determine the corresponding reference_id for |session_id|. - virtual uint32_t DetermineReferenceId(const std::string& session_id) = 0; + // Determine the corresponding session_id for |web_session_id|. + virtual uint32_t LookupSessionId(const std::string& web_session_id) = 0; - // Determine the corresponding session_id for |reference_id|. - virtual const std::string LookupSessionId(uint32_t reference_id) = 0; + // Determine the corresponding session_id for |session_id|. + virtual const std::string LookupWebSessionId(uint32_t session_id) = 0; + // Map between session_id and web_session_id. // TODO(jrummell): The following can be removed once CDM_1 and CDM_2 are // no longer supported. typedef std::map<uint32_t, std::string> SessionMap; - static const uint32_t kInvalidReferenceId = 0; - - // Map between session_id and reference_id. SessionMap session_map_; + static const uint32_t kInvalidSessionId = 0; + // As the response from PrefixedGenerateKeyRequest() may be synchronous or // asynchronous, keep track of the current request during the call to handle // synchronous responses or errors. If no response received, add this request // to a queue and assume that the subsequent responses come back in the order // issued. // TODO(jrummell): Remove once all supported CDM host interfaces support - // reference_id. - uint32_t current_key_request_reference_id_; - std::queue<uint32_t> pending_key_request_reference_ids_; + // session_id. + uint32_t current_key_request_session_id_; + std::queue<uint32_t> pending_key_request_session_ids_; protected: - CdmWrapper() : current_key_request_reference_id_(kInvalidReferenceId) {} + CdmWrapper() : current_key_request_session_id_(kInvalidSessionId) {} private: DISALLOW_COPY_AND_ASSIGN(CdmWrapper); @@ -147,24 +147,23 @@ class CdmWrapperImpl : public CdmWrapper { cdm_->Destroy(); } - virtual void CreateSession(uint32_t reference_id, + virtual void CreateSession(uint32_t session_id, const char* type, uint32_t type_size, const uint8_t* init_data, uint32_t init_data_size) OVERRIDE { - cdm_->CreateSession( - reference_id, type, type_size, init_data, init_data_size); + cdm_->CreateSession(session_id, type, type_size, init_data, init_data_size); } - virtual Result UpdateSession(uint32_t reference_id, + virtual Result UpdateSession(uint32_t session_id, const uint8_t* response, uint32_t response_size) OVERRIDE { - cdm_->UpdateSession(reference_id, response, response_size); + cdm_->UpdateSession(session_id, response, response_size); return NO_ACTION; } - virtual Result ReleaseSession(uint32_t reference_id) OVERRIDE { - cdm_->ReleaseSession(reference_id); + virtual Result ReleaseSession(uint32_t session_id) OVERRIDE { + cdm_->ReleaseSession(session_id); return NO_ACTION; } @@ -218,43 +217,42 @@ class CdmWrapperImpl : public CdmWrapper { cdm_->OnQueryOutputProtectionStatus(link_mask, output_protection_mask); } - uint32_t DetermineReferenceId(const std::string& session_id) { + uint32_t LookupSessionId(const std::string& web_session_id) { for (SessionMap::iterator it = session_map_.begin(); it != session_map_.end(); ++it) { - if (it->second == session_id) + if (it->second == web_session_id) return it->first; } // There is no entry in the map; assume it came from the current // PrefixedGenerateKeyRequest() call (if possible). If no current request, // assume it came from the oldest PrefixedGenerateKeyRequest() call. - uint32_t reference_id = current_key_request_reference_id_; - if (current_key_request_reference_id_) { + uint32_t session_id = current_key_request_session_id_; + if (current_key_request_session_id_) { // Only 1 response is allowed for the current // PrefixedGenerateKeyRequest(). - current_key_request_reference_id_ = kInvalidReferenceId; + current_key_request_session_id_ = kInvalidSessionId; } else { - PP_DCHECK(!pending_key_request_reference_ids_.empty()); - reference_id = pending_key_request_reference_ids_.front(); - pending_key_request_reference_ids_.pop(); + PP_DCHECK(!pending_key_request_session_ids_.empty()); + session_id = pending_key_request_session_ids_.front(); + pending_key_request_session_ids_.pop(); } // If this is a valid |session_id|, add it to the list. Otherwise, avoid // adding empty string as a mapping to prevent future calls with an empty - // string from using the wrong reference_id. - if (!session_id.empty()) { - PP_DCHECK(session_map_.find(reference_id) == session_map_.end()); - PP_DCHECK(!session_id.empty()); - session_map_[reference_id] = session_id; + // string from using the wrong session_id. + if (!web_session_id.empty()) { + PP_DCHECK(session_map_.find(session_id) == session_map_.end()); + session_map_[session_id] = web_session_id; } - return reference_id; + return session_id; } - const std::string LookupSessionId(uint32_t reference_id) { + const std::string LookupWebSessionId(uint32_t session_id) { // Session may not exist if error happens during CreateSession(). - SessionMap::iterator it = session_map_.find(reference_id); + SessionMap::iterator it = session_map_.find(session_id); return (it != session_map_.end()) ? it->second : std::string(); } @@ -276,14 +274,14 @@ class CdmWrapperImpl : public CdmWrapper { template <class CdmInterface> void PrefixedGenerateKeyRequest(CdmWrapper* wrapper, CdmInterface* cdm, - uint32_t reference_id, + uint32_t session_id, const char* type, uint32_t type_size, const uint8_t* init_data, uint32_t init_data_size) { // As it is possible for CDMs to reply synchronously during the call to - // GenerateKeyRequest(), keep track of |reference_id|. - wrapper->current_key_request_reference_id_ = reference_id; + // GenerateKeyRequest(), keep track of |session_id|. + wrapper->current_key_request_session_id_ = session_id; cdm::Status status = cdm->GenerateKeyRequest(type, type_size, init_data, init_data_size); @@ -291,42 +289,41 @@ void PrefixedGenerateKeyRequest(CdmWrapper* wrapper, if (status != cdm::kSuccess) { // If GenerateKeyRequest() failed, no subsequent asynchronous replies // will be sent. Verify that a response was sent synchronously. - PP_DCHECK(wrapper->current_key_request_reference_id_ == - CdmWrapper::kInvalidReferenceId); - wrapper->current_key_request_reference_id_ = - CdmWrapper::kInvalidReferenceId; + PP_DCHECK(wrapper->current_key_request_session_id_ == + CdmWrapper::kInvalidSessionId); + wrapper->current_key_request_session_id_ = CdmWrapper::kInvalidSessionId; return; } - if (wrapper->current_key_request_reference_id_) { + if (wrapper->current_key_request_session_id_) { // If this request is still pending (SendKeyMessage() or SendKeyError() - // not called synchronously), add |reference_id| to the end of the queue. + // not called synchronously), add |session_id| to the end of the queue. // Without CDM support, it is impossible to match SendKeyMessage() - // (or SendKeyError()) responses to the |reference_id|. Doing the best + // (or SendKeyError()) responses to the |session_id|. Doing the best // we can by keeping track of this in a queue, and assuming the responses // come back in order. - wrapper->pending_key_request_reference_ids_.push(reference_id); - wrapper->current_key_request_reference_id_ = - CdmWrapper::kInvalidReferenceId; + wrapper->pending_key_request_session_ids_.push(session_id); + wrapper->current_key_request_session_id_ = CdmWrapper::kInvalidSessionId; } } template <class CdmInterface> CdmWrapper::Result PrefixedAddKey(CdmWrapper* wrapper, CdmInterface* cdm, - uint32_t reference_id, + uint32_t session_id, const uint8_t* response, uint32_t response_size) { - const std::string session_id = wrapper->LookupSessionId(reference_id); - if (session_id.empty()) { + const std::string web_session_id = wrapper->LookupWebSessionId(session_id); + if (web_session_id.empty()) { // Possible if UpdateSession() called before CreateSession(). return CdmWrapper::CALL_KEY_ERROR; } // CDM_1 and CDM_2 accept initdata, which is no longer needed. // In it's place pass in NULL. - cdm::Status status = cdm->AddKey( - session_id.data(), session_id.size(), response, response_size, NULL, 0); + cdm::Status status = cdm->AddKey(web_session_id.data(), web_session_id.size(), + response, response_size, + NULL, 0); PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError); if (status != cdm::kSuccess) { // Some CDMs using Host_1/2 don't call keyerror, so send one. @@ -339,16 +336,16 @@ CdmWrapper::Result PrefixedAddKey(CdmWrapper* wrapper, template <class CdmInterface> CdmWrapper::Result PrefixedCancelKeyRequest(CdmWrapper* wrapper, CdmInterface* cdm, - uint32_t reference_id) { - const std::string session_id = wrapper->LookupSessionId(reference_id); - if (session_id.empty()) { + uint32_t session_id) { + const std::string web_session_id = wrapper->LookupWebSessionId(session_id); + if (web_session_id.empty()) { // Possible if ReleaseSession() called before CreateSession(). return CdmWrapper::CALL_KEY_ERROR; } - wrapper->session_map_.erase(reference_id); + wrapper->session_map_.erase(session_id); cdm::Status status = - cdm->CancelKeyRequest(session_id.data(), session_id.size()); + cdm->CancelKeyRequest(web_session_id.data(), web_session_id.size()); PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError); if (status != cdm::kSuccess) { @@ -363,27 +360,27 @@ CdmWrapper::Result PrefixedCancelKeyRequest(CdmWrapper* wrapper, template <> void CdmWrapperImpl<cdm::ContentDecryptionModule_1>::CreateSession( - uint32_t reference_id, + uint32_t session_id, const char* type, uint32_t type_size, const uint8_t* init_data, uint32_t init_data_size) { PrefixedGenerateKeyRequest( - this, cdm_, reference_id, type, type_size, init_data, init_data_size); + this, cdm_, session_id, type, type_size, init_data, init_data_size); } template <> CdmWrapper::Result CdmWrapperImpl< - cdm::ContentDecryptionModule_1>::UpdateSession(uint32_t reference_id, + cdm::ContentDecryptionModule_1>::UpdateSession(uint32_t session_id, const uint8_t* response, uint32_t response_size) { - return PrefixedAddKey(this, cdm_, reference_id, response, response_size); + return PrefixedAddKey(this, cdm_, session_id, response, response_size); } template <> CdmWrapper::Result CdmWrapperImpl< - cdm::ContentDecryptionModule_1>::ReleaseSession(uint32_t reference_id) { - return PrefixedCancelKeyRequest(this, cdm_, reference_id); + cdm::ContentDecryptionModule_1>::ReleaseSession(uint32_t session_id) { + return PrefixedCancelKeyRequest(this, cdm_, session_id); } template <> void CdmWrapperImpl<cdm::ContentDecryptionModule_1>:: @@ -416,27 +413,27 @@ template <> cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_1>:: template <> void CdmWrapperImpl<cdm::ContentDecryptionModule_2>::CreateSession( - uint32_t reference_id, + uint32_t session_id, const char* type, uint32_t type_size, const uint8_t* init_data, uint32_t init_data_size) { PrefixedGenerateKeyRequest( - this, cdm_, reference_id, type, type_size, init_data, init_data_size); + this, cdm_, session_id, type, type_size, init_data, init_data_size); } template <> CdmWrapper::Result CdmWrapperImpl< - cdm::ContentDecryptionModule_2>::UpdateSession(uint32_t reference_id, + cdm::ContentDecryptionModule_2>::UpdateSession(uint32_t session_id, const uint8_t* response, uint32_t response_size) { - return PrefixedAddKey(this, cdm_, reference_id, response, response_size); + return PrefixedAddKey(this, cdm_, session_id, response, response_size); } template <> CdmWrapper::Result CdmWrapperImpl< - cdm::ContentDecryptionModule_2>::ReleaseSession(uint32_t reference_id) { - return PrefixedCancelKeyRequest(this, cdm_, reference_id); + cdm::ContentDecryptionModule_2>::ReleaseSession(uint32_t session_id) { + return PrefixedCancelKeyRequest(this, cdm_, session_id); } CdmWrapper* CdmWrapper::Create(const char* key_system, diff --git a/media/cdm/ppapi/clear_key_cdm.cc b/media/cdm/ppapi/clear_key_cdm.cc index 3fc10e1..6d3a68c 100644 --- a/media/cdm/ppapi/clear_key_cdm.cc +++ b/media/cdm/ppapi/clear_key_cdm.cc @@ -159,9 +159,9 @@ const char* GetCdmVersion() { namespace media { // Since all the calls to AesDecryptor are synchronous, pass a dummy value for -// reference_id that is never exposed outside this class. +// session_id that is never exposed outside this class. // TODO(jrummell): Remove usage of this when the CDM interface is updated -// to use reference_id. +// to use session_id. ClearKeyCdm::Client::Client() : status_(kNone), error_code_(MediaKeys::kUnknownError), system_code_(0) {} @@ -170,20 +170,20 @@ ClearKeyCdm::Client::~Client() {} void ClearKeyCdm::Client::Reset() { status_ = kNone; - session_id_.clear(); + web_session_id_.clear(); message_.clear(); destination_url_.clear(); error_code_ = MediaKeys::kUnknownError; system_code_ = 0; } -void ClearKeyCdm::Client::OnSessionCreated(uint32 reference_id, - const std::string& session_id) { +void ClearKeyCdm::Client::OnSessionCreated(uint32 session_id, + const std::string& web_session_id) { status_ = static_cast<Status>(status_ | kCreated); - session_id_ = session_id; + web_session_id_ = web_session_id; } -void ClearKeyCdm::Client::OnSessionMessage(uint32 reference_id, +void ClearKeyCdm::Client::OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url) { status_ = static_cast<Status>(status_ | kMessage); @@ -191,15 +191,15 @@ void ClearKeyCdm::Client::OnSessionMessage(uint32 reference_id, destination_url_ = destination_url; } -void ClearKeyCdm::Client::OnSessionReady(uint32 reference_id) { +void ClearKeyCdm::Client::OnSessionReady(uint32 session_id) { status_ = static_cast<Status>(status_ | kReady); } -void ClearKeyCdm::Client::OnSessionClosed(uint32 reference_id) { +void ClearKeyCdm::Client::OnSessionClosed(uint32 session_id) { status_ = static_cast<Status>(status_ | kClosed); } -void ClearKeyCdm::Client::OnSessionError(uint32 reference_id, +void ClearKeyCdm::Client::OnSessionError(uint32 session_id, media::MediaKeys::KeyError error_code, int system_code) { status_ = static_cast<Status>(status_ | kError); @@ -236,27 +236,27 @@ cdm::Status ClearKeyCdm::GenerateKeyRequest(const char* type, DVLOG(1) << "GenerateKeyRequest()"; base::AutoLock auto_lock(client_lock_); ScopedResetter<Client> auto_resetter(&client_); - decryptor_.CreateSession(MediaKeys::kInvalidReferenceId, + decryptor_.CreateSession(MediaKeys::kInvalidSessionId, std::string(type, type_size), init_data, init_data_size); if (client_.status() != (Client::kMessage | Client::kCreated)) { // Use values returned to client if possible. - host_->SendKeyError(client_.session_id().data(), - client_.session_id().size(), + host_->SendKeyError(client_.web_session_id().data(), + client_.web_session_id().size(), static_cast<cdm::MediaKeyError>(client_.error_code()), client_.system_code()); return cdm::kSessionError; } host_->SendKeyMessage( - client_.session_id().data(), client_.session_id().size(), + client_.web_session_id().data(), client_.web_session_id().size(), reinterpret_cast<const char*>(&client_.message()[0]), client_.message().size(), client_.destination_url().data(), client_.destination_url().size()); // Only save the latest session ID for heartbeat messages. - heartbeat_session_id_ = client_.session_id(); + heartbeat_session_id_ = client_.web_session_id(); return cdm::kSuccess; } @@ -271,7 +271,7 @@ cdm::Status ClearKeyCdm::AddKey(const char* session_id, DCHECK(!key_id && !key_id_size); base::AutoLock auto_lock(client_lock_); ScopedResetter<Client> auto_resetter(&client_); - decryptor_.UpdateSession(MediaKeys::kInvalidReferenceId, key, key_size); + decryptor_.UpdateSession(MediaKeys::kInvalidSessionId, key, key_size); if (client_.status() != Client::kReady) { host_->SendKeyError(session_id, session_id_size, @@ -293,7 +293,7 @@ cdm::Status ClearKeyCdm::CancelKeyRequest(const char* session_id, DVLOG(1) << "CancelKeyRequest()"; base::AutoLock auto_lock(client_lock_); ScopedResetter<Client> auto_resetter(&client_); - decryptor_.ReleaseSession(MediaKeys::kInvalidReferenceId); + decryptor_.ReleaseSession(MediaKeys::kInvalidSessionId); // No message normally sent by Release(), but if an error occurred, // report it as a failure. diff --git a/media/cdm/ppapi/clear_key_cdm.h b/media/cdm/ppapi/clear_key_cdm.h index 4c5cb34..0ec18a1 100644 --- a/media/cdm/ppapi/clear_key_cdm.h +++ b/media/cdm/ppapi/clear_key_cdm.h @@ -72,7 +72,7 @@ class ClearKeyCdm : public ClearKeyCdmInterface { class Client { public: // TODO(jrummell): Remove bitmask and rename kNone to kInvalid once CDM - // interface supports reference_id passing completely. + // interface supports session_id passing completely. enum Status { kNone = 0, kCreated = 1 << 0, @@ -86,7 +86,7 @@ class ClearKeyCdm : public ClearKeyCdmInterface { virtual ~Client(); Status status() { return status_; } - const std::string& session_id() { return session_id_; } + const std::string& web_session_id() { return web_session_id_; } const std::vector<uint8>& message() { return message_; } const std::string& destination_url() { return destination_url_; } MediaKeys::KeyError error_code() { return error_code_; } @@ -95,19 +95,19 @@ class ClearKeyCdm : public ClearKeyCdmInterface { // Resets the Client to a clean state. void Reset(); - void OnSessionCreated(uint32 reference_id, const std::string& session_id); - void OnSessionMessage(uint32 reference_id, + void OnSessionCreated(uint32 session_id, const std::string& web_session_id); + void OnSessionMessage(uint32 session_id, const std::vector<uint8>& message, const std::string& destination_url); - void OnSessionReady(uint32 reference_id); - void OnSessionClosed(uint32 reference_id); - void OnSessionError(uint32 reference_id, + void OnSessionReady(uint32 session_id); + void OnSessionClosed(uint32 session_id); + void OnSessionError(uint32 session_id, MediaKeys::KeyError error_code, int system_code); private: Status status_; - std::string session_id_; + std::string web_session_id_; std::vector<uint8> message_; std::string destination_url_; MediaKeys::KeyError error_code_; diff --git a/media/filters/pipeline_integration_test.cc b/media/filters/pipeline_integration_test.cc index 06566ec..f828402 100644 --- a/media/filters/pipeline_integration_test.cc +++ b/media/filters/pipeline_integration_test.cc @@ -80,21 +80,21 @@ class FakeEncryptedMedia { public: virtual ~AppBase() {} - virtual void SetSession(uint32 reference_id, - const std::string& session_id) = 0; + virtual void OnSessionCreated(uint32 session_id, + const std::string& web_session_id) = 0; - virtual void Message(uint32 reference_id, - const std::vector<uint8>& message, - const std::string& destination_url) = 0; + virtual void OnSessionMessage(uint32 session_id, + const std::vector<uint8>& message, + const std::string& destination_url) = 0; - virtual void Ready(uint32 reference_id) = 0; + virtual void OnSessionReady(uint32 session_id) = 0; - virtual void Closed(uint32 reference_id) = 0; + virtual void OnSessionClosed(uint32 session_id) = 0; // Errors are not expected unless overridden. - virtual void Error(uint32 reference_id, - MediaKeys::KeyError error_code, - int system_code) { + virtual void OnSessionError(uint32 session_id, + MediaKeys::KeyError error_code, + int system_code) { FAIL() << "Unexpected Key Error"; } @@ -104,42 +104,45 @@ class FakeEncryptedMedia { }; FakeEncryptedMedia(AppBase* app) - : decryptor_( - base::Bind(&FakeEncryptedMedia::SetSession, base::Unretained(this)), - base::Bind(&FakeEncryptedMedia::Message, base::Unretained(this)), - base::Bind(&FakeEncryptedMedia::Ready, base::Unretained(this)), - base::Bind(&FakeEncryptedMedia::Closed, base::Unretained(this)), - base::Bind(&FakeEncryptedMedia::Error, base::Unretained(this))), - app_(app) { - } + : decryptor_(base::Bind(&FakeEncryptedMedia::OnSessionCreated, + base::Unretained(this)), + base::Bind(&FakeEncryptedMedia::OnSessionMessage, + base::Unretained(this)), + base::Bind(&FakeEncryptedMedia::OnSessionReady, + base::Unretained(this)), + base::Bind(&FakeEncryptedMedia::OnSessionClosed, + base::Unretained(this)), + base::Bind(&FakeEncryptedMedia::OnSessionError, + base::Unretained(this))), + app_(app) {} AesDecryptor* decryptor() { return &decryptor_; } // Callbacks for firing session events. Delegate to |app_|. - void SetSession(uint32 reference_id, const std::string& session_id) { - app_->SetSession(reference_id, session_id); + void OnSessionCreated(uint32 session_id, const std::string& web_session_id) { + app_->OnSessionCreated(session_id, web_session_id); } - void Message(uint32 reference_id, - const std::vector<uint8>& message, - const std::string& destination_url) { - app_->Message(reference_id, message, destination_url); + void OnSessionMessage(uint32 session_id, + const std::vector<uint8>& message, + const std::string& destination_url) { + app_->OnSessionMessage(session_id, message, destination_url); } - void Ready(uint32 reference_id) { - app_->Ready(reference_id); + void OnSessionReady(uint32 session_id) { + app_->OnSessionReady(session_id); } - void Closed(uint32 reference_id) { - app_->Closed(reference_id); + void OnSessionClosed(uint32 session_id) { + app_->OnSessionClosed(session_id); } - void Error(uint32 reference_id, - MediaKeys::KeyError error_code, - int system_code) { - app_->Error(reference_id, error_code, system_code); + void OnSessionError(uint32 session_id, + MediaKeys::KeyError error_code, + int system_code) { + app_->OnSessionError(session_id, error_code, system_code); } void NeedKey(const std::string& type, @@ -155,40 +158,40 @@ class FakeEncryptedMedia { // Provides |kSecretKey| in response to needkey. class KeyProvidingApp : public FakeEncryptedMedia::AppBase { public: - KeyProvidingApp() : current_reference_id_(0) {} + KeyProvidingApp() : current_session_id_(0) {} - virtual void SetSession(uint32 reference_id, - const std::string& session_id) OVERRIDE { - EXPECT_GT(reference_id, 0u); - EXPECT_FALSE(session_id.empty()); + virtual void OnSessionCreated(uint32 session_id, + const std::string& web_session_id) OVERRIDE { + EXPECT_GT(session_id, 0u); + EXPECT_FALSE(web_session_id.empty()); } - virtual void Message(uint32 reference_id, - const std::vector<uint8>& message, - const std::string& default_url) OVERRIDE { - EXPECT_GT(reference_id, 0u); + virtual void OnSessionMessage(uint32 session_id, + const std::vector<uint8>& message, + const std::string& default_url) OVERRIDE { + EXPECT_GT(session_id, 0u); EXPECT_FALSE(message.empty()); - current_reference_id_ = reference_id; + current_session_id_ = session_id; } - virtual void Ready(uint32 reference_id) OVERRIDE { - EXPECT_GT(reference_id, 0u); + virtual void OnSessionReady(uint32 session_id) OVERRIDE { + EXPECT_GT(session_id, 0u); } - virtual void Closed(uint32 reference_id) OVERRIDE { - EXPECT_GT(reference_id, 0u); + virtual void OnSessionClosed(uint32 session_id) OVERRIDE { + EXPECT_GT(session_id, 0u); } virtual void NeedKey(const std::string& type, const std::vector<uint8>& init_data, AesDecryptor* decryptor) OVERRIDE { - if (current_reference_id_ == 0u) { + if (current_session_id_ == 0u) { EXPECT_TRUE( decryptor->CreateSession(12, type, kInitData, arraysize(kInitData))); } - EXPECT_EQ(current_reference_id_, 12u); + EXPECT_EQ(current_session_id_, 12u); // Clear Key really needs the key ID in |init_data|. For WebM, they are the // same, but this is not the case for ISO CENC. Therefore, provide the @@ -203,40 +206,40 @@ class KeyProvidingApp : public FakeEncryptedMedia::AppBase { // Convert key into a JSON structure and then add it. std::string jwk = GenerateJWKSet( kSecretKey, arraysize(kSecretKey), key_id, key_id_length); - decryptor->UpdateSession(current_reference_id_, + decryptor->UpdateSession(current_session_id_, reinterpret_cast<const uint8*>(jwk.data()), jwk.size()); } - uint32 current_reference_id_; + uint32 current_session_id_; }; // Ignores needkey and does not perform a license request class NoResponseApp : public FakeEncryptedMedia::AppBase { public: - virtual void SetSession(uint32 reference_id, - const std::string& session_id) OVERRIDE { - EXPECT_GT(reference_id, 0u); - EXPECT_FALSE(session_id.empty()); - } + virtual void OnSessionCreated(uint32 session_id, + const std::string& web_session_id) OVERRIDE { + EXPECT_GT(session_id, 0u); + EXPECT_FALSE(web_session_id.empty()); + } - virtual void Message(uint32 reference_id, - const std::vector<uint8>& message, - const std::string& default_url) OVERRIDE { - EXPECT_GT(reference_id, 0u); - EXPECT_FALSE(message.empty()); - FAIL() << "Unexpected KeyMessage"; - } - - virtual void Ready(uint32 reference_id) OVERRIDE { - EXPECT_GT(reference_id, 0u); - FAIL() << "Unexpected Ready"; - } - - virtual void Closed(uint32 reference_id) OVERRIDE { - EXPECT_GT(reference_id, 0u); - FAIL() << "Unexpected Closed"; - } + virtual void OnSessionMessage(uint32 session_id, + const std::vector<uint8>& message, + const std::string& default_url) OVERRIDE { + EXPECT_GT(session_id, 0u); + EXPECT_FALSE(message.empty()); + FAIL() << "Unexpected KeyMessage"; + } + + virtual void OnSessionReady(uint32 session_id) OVERRIDE { + EXPECT_GT(session_id, 0u); + FAIL() << "Unexpected Ready"; + } + + virtual void OnSessionClosed(uint32 session_id) OVERRIDE { + EXPECT_GT(session_id, 0u); + FAIL() << "Unexpected Closed"; + } virtual void NeedKey(const std::string& type, const std::vector<uint8>& init_data, diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl index 0d990eb..cade724 100644 --- a/ppapi/api/private/ppb_content_decryptor_private.idl +++ b/ppapi/api/private/ppb_content_decryptor_private.idl @@ -26,7 +26,7 @@ interface PPB_ContentDecryptor_Private { /** * A session has been created by the CDM. * - * @param[in] reference_id A reference for the session for which the CDM + * @param[in] session_id Identifies the session for which the CDM * created a session. * * @param[in] web_session_id A <code>PP_Var</code> of type @@ -36,7 +36,7 @@ interface PPB_ContentDecryptor_Private { */ void SessionCreated( [in] PP_Instance instance, - [in] uint32_t reference_id, + [in] uint32_t session_id, [in] PP_Var web_session_id); /** @@ -53,7 +53,7 @@ interface PPB_ContentDecryptor_Private { * of <code>UpdateSession()</code> and <code>SessionMessage()</code> calls * required to prepare for decryption. * - * @param[in] reference_id A reference for the session for which the message + * @param[in] session_id Identifies the session for which the message * is intended. * * @param[in] message A <code>PP_Var</code> of type @@ -65,7 +65,7 @@ interface PPB_ContentDecryptor_Private { */ void SessionMessage( [in] PP_Instance instance, - [in] uint32_t reference_id, + [in] uint32_t session_id, [in] PP_Var message, [in] PP_Var destination_url); @@ -81,11 +81,11 @@ interface PPB_ContentDecryptor_Private { * The CDM must call <code>SessionReady()</code> when the sequence is * completed, and, in response, the browser must notify the web application. * - * @param[in] reference_id A reference for the session that is ready. + * @param[in] session_id Identifies the session that is ready. */ void SessionReady( [in] PP_Instance instance, - [in] uint32_t reference_id); + [in] uint32_t session_id); /** * The session has been closed as the result of a call to the @@ -93,17 +93,17 @@ interface PPB_ContentDecryptor_Private { * <code>PPP_ContentDecryptor_Private</code> interface, or due to other * factors as determined by the CDM. * - * @param[in] reference_id A reference for the session that is closed. + * @param[in] session_id Identifies the session that is closed. */ void SessionClosed( [in] PP_Instance instance, - [in] uint32_t reference_id); + [in] uint32_t session_id); /** * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method, * or within the plugin implementing the interface. * - * @param[in] reference_id A reference for the session for which the error + * @param[in] session_id Identifies the session for which the error * is intended. * * @param[in] media_error A MediaKeyError. @@ -112,7 +112,7 @@ interface PPB_ContentDecryptor_Private { */ void SessionError( [in] PP_Instance instance, - [in] uint32_t reference_id, + [in] uint32_t session_id, [in] int32_t media_error, [in] int32_t system_code); diff --git a/ppapi/api/private/ppp_content_decryptor_private.idl b/ppapi/api/private/ppp_content_decryptor_private.idl index 11cffe0..b943efe 100644 --- a/ppapi/api/private/ppp_content_decryptor_private.idl +++ b/ppapi/api/private/ppp_content_decryptor_private.idl @@ -40,7 +40,7 @@ interface PPP_ContentDecryptor_Private { * browser by the CDM via <code>SessionCreated()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface. * - * @param[in] reference_id A reference for the session for which a session + * @param[in] session_id A reference for the session for which a session * should be generated. * * @param[in] type A <code>PP_Var</code> of type @@ -52,7 +52,7 @@ interface PPP_ContentDecryptor_Private { */ void CreateSession( [in] PP_Instance instance, - [in] uint32_t reference_id, + [in] uint32_t session_id, [in] PP_Var type, [in] PP_Var init_data); @@ -68,7 +68,7 @@ interface PPP_ContentDecryptor_Private { * <code>PPB_ContentDecryptor_Private</code> interface, and the browser * must notify the web application. * - * @param[in] reference_id A reference for the session to update. + * @param[in] session_id A reference for the session to update. * * @param[in] response A <code>PP_Var</code> of type * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other @@ -76,18 +76,18 @@ interface PPP_ContentDecryptor_Private { */ void UpdateSession( [in] PP_Instance instance, - [in] uint32_t reference_id, + [in] uint32_t session_id, [in] PP_Var response); /** * Release the specified session and related resources. * - * @param[in] reference_id A reference for the session that should be + * @param[in] session_id A reference for the session that should be * released. */ void ReleaseSession( [in] PP_Instance instance, - [in] uint32_t reference_id); + [in] uint32_t session_id); /** * Decrypts the block and returns the unencrypted block via diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h index 18fa715..58492a0 100644 --- a/ppapi/c/private/ppb_content_decryptor_private.h +++ b/ppapi/c/private/ppb_content_decryptor_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_content_decryptor_private.idl, - * modified Wed Nov 27 14:10:24 2013. + * modified Fri Dec 6 12:16:22 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -46,7 +46,7 @@ struct PPB_ContentDecryptor_Private_0_9 { /** * A session has been created by the CDM. * - * @param[in] reference_id A reference for the session for which the CDM + * @param[in] session_id Identifies the session for which the CDM * created a session. * * @param[in] web_session_id A <code>PP_Var</code> of type @@ -55,7 +55,7 @@ struct PPB_ContentDecryptor_Private_0_9 { * */ void (*SessionCreated)(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, struct PP_Var web_session_id); /** * A message or request has been generated for key_system in the CDM, and @@ -71,7 +71,7 @@ struct PPB_ContentDecryptor_Private_0_9 { * of <code>UpdateSession()</code> and <code>SessionMessage()</code> calls * required to prepare for decryption. * - * @param[in] reference_id A reference for the session for which the message + * @param[in] session_id Identifies the session for which the message * is intended. * * @param[in] message A <code>PP_Var</code> of type @@ -82,7 +82,7 @@ struct PPB_ContentDecryptor_Private_0_9 { * message. */ void (*SessionMessage)(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, struct PP_Var message, struct PP_Var destination_url); /** @@ -97,23 +97,23 @@ struct PPB_ContentDecryptor_Private_0_9 { * The CDM must call <code>SessionReady()</code> when the sequence is * completed, and, in response, the browser must notify the web application. * - * @param[in] reference_id A reference for the session that is ready. + * @param[in] session_id Identifies the session that is ready. */ - void (*SessionReady)(PP_Instance instance, uint32_t reference_id); + void (*SessionReady)(PP_Instance instance, uint32_t session_id); /** * The session has been closed as the result of a call to the * <code>ReleaseSession()</code> method on the * <code>PPP_ContentDecryptor_Private</code> interface, or due to other * factors as determined by the CDM. * - * @param[in] reference_id A reference for the session that is closed. + * @param[in] session_id Identifies the session that is closed. */ - void (*SessionClosed)(PP_Instance instance, uint32_t reference_id); + void (*SessionClosed)(PP_Instance instance, uint32_t session_id); /** * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method, * or within the plugin implementing the interface. * - * @param[in] reference_id A reference for the session for which the error + * @param[in] session_id Identifies the session for which the error * is intended. * * @param[in] media_error A MediaKeyError. @@ -121,7 +121,7 @@ struct PPB_ContentDecryptor_Private_0_9 { * @param[in] system_error A system error code. */ void (*SessionError)(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code); /** diff --git a/ppapi/c/private/ppp_content_decryptor_private.h b/ppapi/c/private/ppp_content_decryptor_private.h index 1873abc..27d172d 100644 --- a/ppapi/c/private/ppp_content_decryptor_private.h +++ b/ppapi/c/private/ppp_content_decryptor_private.h @@ -4,7 +4,7 @@ */ /* From private/ppp_content_decryptor_private.idl, - * modified Wed Nov 27 15:42:55 2013. + * modified Tue Dec 3 17:05:10 2013. */ #ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -60,7 +60,7 @@ struct PPP_ContentDecryptor_Private_0_9 { * browser by the CDM via <code>SessionCreated()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface. * - * @param[in] reference_id A reference for the session for which a session + * @param[in] session_id A reference for the session for which a session * should be generated. * * @param[in] type A <code>PP_Var</code> of type @@ -71,7 +71,7 @@ struct PPP_ContentDecryptor_Private_0_9 { * initialization data. */ void (*CreateSession)(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, struct PP_Var type, struct PP_Var init_data); /** @@ -86,22 +86,22 @@ struct PPP_ContentDecryptor_Private_0_9 { * <code>PPB_ContentDecryptor_Private</code> interface, and the browser * must notify the web application. * - * @param[in] reference_id A reference for the session to update. + * @param[in] session_id A reference for the session to update. * * @param[in] response A <code>PP_Var</code> of type * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other * message for the given session ID. */ void (*UpdateSession)(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, struct PP_Var response); /** * Release the specified session and related resources. * - * @param[in] reference_id A reference for the session that should be + * @param[in] session_id A reference for the session that should be * released. */ - void (*ReleaseSession)(PP_Instance instance, uint32_t reference_id); + void (*ReleaseSession)(PP_Instance instance, uint32_t session_id); /** * Decrypts the block and returns the unencrypted block via * <code>DeliverBlock()</code> on the diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc index 973144c..776393a 100644 --- a/ppapi/cpp/private/content_decryptor_private.cc +++ b/ppapi/cpp/private/content_decryptor_private.cc @@ -39,7 +39,7 @@ void Initialize(PP_Instance instance, } void CreateSession(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var type_arg, PP_Var init_data_arg) { void* object = @@ -56,12 +56,12 @@ void CreateSession(PP_Instance instance, return; pp::VarArrayBuffer init_data_array_buffer(init_data_var); - static_cast<ContentDecryptor_Private*>(object)->CreateSession( - reference_id, type_var.AsString(), init_data_array_buffer); + static_cast<ContentDecryptor_Private*>(object) + ->CreateSession(session_id, type_var.AsString(), init_data_array_buffer); } void UpdateSession(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var response_arg) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); @@ -74,16 +74,16 @@ void UpdateSession(PP_Instance instance, pp::VarArrayBuffer response(response_var); static_cast<ContentDecryptor_Private*>(object) - ->UpdateSession(reference_id, response); + ->UpdateSession(session_id, response); } -void ReleaseSession(PP_Instance instance, uint32_t reference_id) { +void ReleaseSession(PP_Instance instance, uint32_t session_id) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) return; - static_cast<ContentDecryptor_Private*>(object)->ReleaseSession(reference_id); + static_cast<ContentDecryptor_Private*>(object)->ReleaseSession(session_id); } @@ -206,51 +206,52 @@ ContentDecryptor_Private::~ContentDecryptor_Private() { this); } -void ContentDecryptor_Private::SessionCreated(uint32_t reference_id, - const std::string& session_id) { +void ContentDecryptor_Private::SessionCreated( + uint32_t session_id, + const std::string& web_session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { - pp::Var session_id_var(session_id); + pp::Var web_session_id_var(web_session_id); get_interface<PPB_ContentDecryptor_Private>()->SessionCreated( associated_instance_.pp_instance(), - reference_id, - session_id_var.pp_var()); + session_id, + web_session_id_var.pp_var()); } } -void ContentDecryptor_Private::SessionMessage(uint32_t reference_id, +void ContentDecryptor_Private::SessionMessage(uint32_t session_id, pp::VarArrayBuffer message, const std::string& default_url) { if (has_interface<PPB_ContentDecryptor_Private>()) { pp::Var default_url_var(default_url); get_interface<PPB_ContentDecryptor_Private>()->SessionMessage( associated_instance_.pp_instance(), - reference_id, + session_id, message.pp_var(), default_url_var.pp_var()); } } -void ContentDecryptor_Private::SessionReady(uint32_t reference_id) { +void ContentDecryptor_Private::SessionReady(uint32_t session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { get_interface<PPB_ContentDecryptor_Private>()->SessionReady( - associated_instance_.pp_instance(), reference_id); + associated_instance_.pp_instance(), session_id); } } -void ContentDecryptor_Private::SessionClosed(uint32_t reference_id) { +void ContentDecryptor_Private::SessionClosed(uint32_t session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { get_interface<PPB_ContentDecryptor_Private>()->SessionClosed( - associated_instance_.pp_instance(), reference_id); + associated_instance_.pp_instance(), session_id); } } -void ContentDecryptor_Private::SessionError(uint32_t reference_id, +void ContentDecryptor_Private::SessionError(uint32_t session_id, int32_t media_error, int32_t system_code) { if (has_interface<PPB_ContentDecryptor_Private>()) { get_interface<PPB_ContentDecryptor_Private>()->SessionError( associated_instance_.pp_instance(), - reference_id, + session_id, media_error, system_code); } diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h index c2a2ef0..d2c17c1 100644 --- a/ppapi/cpp/private/content_decryptor_private.h +++ b/ppapi/cpp/private/content_decryptor_private.h @@ -32,12 +32,12 @@ class ContentDecryptor_Private { // strings. The change would allow the CDM wrapper to reuse vars when // replying to the browser. virtual void Initialize(const std::string& key_system) = 0; - virtual void CreateSession(uint32_t reference_id, + virtual void CreateSession(uint32_t session_id, const std::string& type, pp::VarArrayBuffer init_data) = 0; - virtual void UpdateSession(uint32_t reference_id, + virtual void UpdateSession(uint32_t session_id, pp::VarArrayBuffer response) = 0; - virtual void ReleaseSession(uint32_t reference_id) = 0; + virtual void ReleaseSession(uint32_t session_id) = 0; virtual void Decrypt(pp::Buffer_Dev encrypted_buffer, const PP_EncryptedBlockInfo& encrypted_block_info) = 0; virtual void InitializeAudioDecoder( @@ -58,13 +58,13 @@ class ContentDecryptor_Private { // PPB_ContentDecryptor_Private methods for passing data from the decryptor // to the browser. - void SessionCreated(uint32_t reference_id, const std::string& session_id); - void SessionMessage(uint32_t reference_id, + void SessionCreated(uint32_t session_id, const std::string& web_session_id); + void SessionMessage(uint32_t session_id, pp::VarArrayBuffer message, const std::string& default_url); - void SessionReady(uint32_t reference_id); - void SessionClosed(uint32_t reference_id); - void SessionError(uint32_t reference_id, + void SessionReady(uint32_t session_id); + void SessionClosed(uint32_t session_id); + void SessionError(uint32_t session_id, int32_t media_error, int32_t system_code); diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 69f3ea4..4a44225 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -2346,29 +2346,29 @@ static struct PP_Var Pnacl_M13_PPP_Selection_Dev_GetSelectedText(PP_Instance ins /* Begin wrapper methods for PPB_ContentDecryptor_Private_0_9 */ -static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionCreated(PP_Instance instance, uint32_t reference_id, struct PP_Var* web_session_id) { +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionCreated(PP_Instance instance, uint32_t session_id, struct PP_Var* web_session_id) { const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; - iface->SessionCreated(instance, reference_id, *web_session_id); + iface->SessionCreated(instance, session_id, *web_session_id); } -static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionMessage(PP_Instance instance, uint32_t reference_id, struct PP_Var* message, struct PP_Var* destination_url) { +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionMessage(PP_Instance instance, uint32_t session_id, struct PP_Var* message, struct PP_Var* destination_url) { const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; - iface->SessionMessage(instance, reference_id, *message, *destination_url); + iface->SessionMessage(instance, session_id, *message, *destination_url); } -static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionReady(PP_Instance instance, uint32_t reference_id) { +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionReady(PP_Instance instance, uint32_t session_id) { const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; - iface->SessionReady(instance, reference_id); + iface->SessionReady(instance, session_id); } -static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionClosed(PP_Instance instance, uint32_t reference_id) { +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionClosed(PP_Instance instance, uint32_t session_id) { const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; - iface->SessionClosed(instance, reference_id); + iface->SessionClosed(instance, session_id); } -static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionError(PP_Instance instance, uint32_t reference_id, int32_t media_error, int32_t system_code) { +static void Pnacl_M33_PPB_ContentDecryptor_Private_SessionError(PP_Instance instance, uint32_t session_id, int32_t media_error, int32_t system_code) { const struct PPB_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_9.real_iface; - iface->SessionError(instance, reference_id, media_error, system_code); + iface->SessionError(instance, session_id, media_error, system_code); } static void Pnacl_M33_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) { @@ -3770,25 +3770,25 @@ static void Pnacl_M33_PPP_ContentDecryptor_Private_Initialize(PP_Instance instan temp_fp(instance, &key_system); } -static void Pnacl_M33_PPP_ContentDecryptor_Private_CreateSession(PP_Instance instance, uint32_t reference_id, struct PP_Var type, struct PP_Var init_data) { +static void Pnacl_M33_PPP_ContentDecryptor_Private_CreateSession(PP_Instance instance, uint32_t session_id, struct PP_Var type, struct PP_Var init_data) { const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; - void (*temp_fp)(PP_Instance instance, uint32_t reference_id, struct PP_Var* type, struct PP_Var* init_data) = - ((void (*)(PP_Instance instance, uint32_t reference_id, struct PP_Var* type, struct PP_Var* init_data))iface->CreateSession); - temp_fp(instance, reference_id, &type, &init_data); + void (*temp_fp)(PP_Instance instance, uint32_t session_id, struct PP_Var* type, struct PP_Var* init_data) = + ((void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var* type, struct PP_Var* init_data))iface->CreateSession); + temp_fp(instance, session_id, &type, &init_data); } -static void Pnacl_M33_PPP_ContentDecryptor_Private_UpdateSession(PP_Instance instance, uint32_t reference_id, struct PP_Var response) { +static void Pnacl_M33_PPP_ContentDecryptor_Private_UpdateSession(PP_Instance instance, uint32_t session_id, struct PP_Var response) { const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; - void (*temp_fp)(PP_Instance instance, uint32_t reference_id, struct PP_Var* response) = - ((void (*)(PP_Instance instance, uint32_t reference_id, struct PP_Var* response))iface->UpdateSession); - temp_fp(instance, reference_id, &response); + void (*temp_fp)(PP_Instance instance, uint32_t session_id, struct PP_Var* response) = + ((void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var* response))iface->UpdateSession); + temp_fp(instance, session_id, &response); } -static void Pnacl_M33_PPP_ContentDecryptor_Private_ReleaseSession(PP_Instance instance, uint32_t reference_id) { +static void Pnacl_M33_PPP_ContentDecryptor_Private_ReleaseSession(PP_Instance instance, uint32_t session_id) { const struct PPP_ContentDecryptor_Private_0_9 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_9.real_iface; - void (*temp_fp)(PP_Instance instance, uint32_t reference_id) = - ((void (*)(PP_Instance instance, uint32_t reference_id))iface->ReleaseSession); - temp_fp(instance, reference_id); + void (*temp_fp)(PP_Instance instance, uint32_t session_id) = + ((void (*)(PP_Instance instance, uint32_t session_id))iface->ReleaseSession); + temp_fp(instance, session_id); } static void Pnacl_M33_PPP_ContentDecryptor_Private_Decrypt(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) { @@ -4669,11 +4669,11 @@ struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 = { /* Not generating wrapper interface for PPP_Zoom_Dev_0_3 */ struct PPB_ContentDecryptor_Private_0_9 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_9 = { - .SessionCreated = (void (*)(PP_Instance instance, uint32_t reference_id, struct PP_Var web_session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionCreated, - .SessionMessage = (void (*)(PP_Instance instance, uint32_t reference_id, struct PP_Var message, struct PP_Var destination_url))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionMessage, - .SessionReady = (void (*)(PP_Instance instance, uint32_t reference_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionReady, - .SessionClosed = (void (*)(PP_Instance instance, uint32_t reference_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionClosed, - .SessionError = (void (*)(PP_Instance instance, uint32_t reference_id, int32_t media_error, int32_t system_code))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionError, + .SessionCreated = (void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var web_session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionCreated, + .SessionMessage = (void (*)(PP_Instance instance, uint32_t session_id, struct PP_Var message, struct PP_Var destination_url))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionMessage, + .SessionReady = (void (*)(PP_Instance instance, uint32_t session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionReady, + .SessionClosed = (void (*)(PP_Instance instance, uint32_t session_id))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionClosed, + .SessionError = (void (*)(PP_Instance instance, uint32_t session_id, int32_t media_error, int32_t system_code))&Pnacl_M33_PPB_ContentDecryptor_Private_SessionError, .DeliverBlock = (void (*)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M33_PPB_ContentDecryptor_Private_DeliverBlock, .DecoderInitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success))&Pnacl_M33_PPB_ContentDecryptor_Private_DecoderInitializeDone, .DecoderDeinitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M33_PPB_ContentDecryptor_Private_DecoderDeinitializeDone, diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index ef6ae4e..6352e65 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -650,16 +650,16 @@ IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_Initialize, ppapi::proxy::SerializedVar /* key_system, String */) IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_CreateSession, PP_Instance /* instance */, - uint32_t /* reference_id */, + uint32_t /* session_id */, ppapi::proxy::SerializedVar /* type, String */, ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */) IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_UpdateSession, PP_Instance /* instance */, - uint32_t /* reference_id */, + uint32_t /* session_id */, ppapi::proxy::SerializedVar /* response, ArrayBuffer */) IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_ReleaseSession, PP_Instance /* instance */, - uint32_t /* reference_id */) + uint32_t /* session_id */) IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Decrypt, PP_Instance /* instance */, ppapi::proxy::PPPDecryptor_Buffer /* buffer */, @@ -984,22 +984,22 @@ IPC_SYNC_MESSAGE_ROUTED2_2( // PPB_ContentDecryptor_Dev messages handled in PPB_Instance_Proxy. IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_SessionCreated, PP_Instance /* instance */, - uint32_t /* reference_id */, - ppapi::proxy::SerializedVar /* session_id, String */) + uint32_t /* session_id */, + ppapi::proxy::SerializedVar /* web_session_id, String */) IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionMessage, PP_Instance /* instance */, - uint32_t /* reference_id */, + uint32_t /* session_id */, ppapi::proxy::SerializedVar /* message, ArrayBuffer */, ppapi::proxy::SerializedVar /* destination_url, String */) IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionReady, PP_Instance /* instance */, - uint32_t /* reference_id */) + uint32_t /* session_id */) IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionClosed, PP_Instance /* instance */, - uint32_t /* reference_id */) + uint32_t /* session_id */) IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionError, PP_Instance /* instance */, - uint32_t /* reference_id */, + uint32_t /* session_id */, int32_t /* media_error */, int32_t /* system_code */) IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_DeliverBlock, diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index d6232ae..5d0e7ed 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -543,45 +543,45 @@ PP_Var PPB_Instance_Proxy::GetPluginReferrerURL( } void PPB_Instance_Proxy::SessionCreated(PP_Instance instance, - uint32_t reference_id, - PP_Var session_id) { + uint32_t session_id, + PP_Var web_session_id) { dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionCreated( API_ID_PPB_INSTANCE, instance, - reference_id, - SerializedVarSendInput(dispatcher(), session_id))); + session_id, + SerializedVarSendInput(dispatcher(), web_session_id))); } void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var message, PP_Var destination_url) { dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( API_ID_PPB_INSTANCE, instance, - reference_id, + session_id, SerializedVarSendInput(dispatcher(), message), SerializedVarSendInput(dispatcher(), destination_url))); } void PPB_Instance_Proxy::SessionReady(PP_Instance instance, - uint32_t reference_id) { + uint32_t session_id) { dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( - API_ID_PPB_INSTANCE, instance, reference_id)); + API_ID_PPB_INSTANCE, instance, session_id)); } void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, - uint32_t reference_id) { + uint32_t session_id) { dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed( - API_ID_PPB_INSTANCE, instance, reference_id)); + API_ID_PPB_INSTANCE, instance, session_id)); } void PPB_Instance_Proxy::SessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code) { dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError( - API_ID_PPB_INSTANCE, instance, reference_id, media_error, system_code)); + API_ID_PPB_INSTANCE, instance, session_id, media_error, system_code)); } void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, @@ -1050,20 +1050,20 @@ void PPB_Instance_Proxy::OnHostMsgGetPluginReferrerURL( void PPB_Instance_Proxy::OnHostMsgSessionCreated( PP_Instance instance, - uint32_t reference_id, - SerializedVarReceiveInput session_id) { + uint32_t session_id, + SerializedVarReceiveInput web_session_id) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) { enter.functions()->SessionCreated( - instance, reference_id, session_id.Get(dispatcher())); + instance, session_id, web_session_id.Get(dispatcher())); } } void PPB_Instance_Proxy::OnHostMsgSessionMessage( PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, SerializedVarReceiveInput message, SerializedVarReceiveInput destination_url) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) @@ -1071,34 +1071,34 @@ void PPB_Instance_Proxy::OnHostMsgSessionMessage( EnterInstanceNoLock enter(instance); if (enter.succeeded()) { enter.functions()->SessionMessage(instance, - reference_id, + session_id, message.Get(dispatcher()), destination_url.Get(dispatcher())); } } void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance, - uint32_t reference_id) { + uint32_t session_id) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) { - enter.functions()->SessionReady(instance, reference_id); + enter.functions()->SessionReady(instance, session_id); } } void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance, - uint32_t reference_id) { + uint32_t session_id) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) { - enter.functions()->SessionClosed(instance, reference_id); + enter.functions()->SessionClosed(instance, session_id); } } void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_error) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) @@ -1106,7 +1106,7 @@ void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, EnterInstanceNoLock enter(instance); if (enter.succeeded()) { enter.functions()->SessionError( - instance, reference_id, media_error, system_error); + instance, session_id, media_error, system_error); } } diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index 2b02051..12e56b9 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -118,18 +118,17 @@ class PPB_Instance_Proxy : public InterfaceProxy, PP_Instance instance, PP_URLComponents_Dev* components) OVERRIDE; virtual void SessionCreated(PP_Instance instance, - uint32_t reference_id, - PP_Var session_id) OVERRIDE; + uint32_t session_id, + PP_Var web_session_id) OVERRIDE; virtual void SessionMessage(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var message, PP_Var destination_url) OVERRIDE; - virtual void SessionReady(PP_Instance instance, - uint32_t reference_id) OVERRIDE; + virtual void SessionReady(PP_Instance instance, uint32_t session_id) OVERRIDE; virtual void SessionClosed(PP_Instance instance, - uint32_t reference_id) OVERRIDE; + uint32_t session_id) OVERRIDE; virtual void SessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code) OVERRIDE; virtual void DeliverBlock(PP_Instance instance, @@ -222,20 +221,20 @@ class PPB_Instance_Proxy : public InterfaceProxy, SerializedVarReturnValue result); void OnHostMsgGetPluginReferrerURL(PP_Instance instance, SerializedVarReturnValue result); - virtual void OnHostMsgSessionCreated(PP_Instance instance, - uint32_t reference_id, - SerializedVarReceiveInput session_id); + virtual void OnHostMsgSessionCreated( + PP_Instance instance, + uint32_t session_id, + SerializedVarReceiveInput web_session_id); virtual void OnHostMsgSessionMessage( PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, SerializedVarReceiveInput message, SerializedVarReceiveInput destination_url); - virtual void OnHostMsgSessionReady(PP_Instance instance, - uint32_t reference_id); + virtual void OnHostMsgSessionReady(PP_Instance instance, uint32_t session_id); virtual void OnHostMsgSessionClosed(PP_Instance instance, - uint32_t reference_id); + uint32_t session_id); virtual void OnHostMsgSessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code); virtual void OnHostMsgDecoderInitializeDone( diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc index f0fa47a..167e476 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc @@ -125,7 +125,7 @@ void Initialize(PP_Instance instance, } void CreateSession(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, PP_Var type, PP_Var init_data) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); @@ -137,14 +137,12 @@ void CreateSession(PP_Instance instance, dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession( API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, - reference_id, + session_id, SerializedVarSendInput(dispatcher, type), SerializedVarSendInput(dispatcher, init_data))); } -void UpdateSession(PP_Instance instance, - uint32_t reference_id, - PP_Var response) { +void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { NOTREACHED(); @@ -154,11 +152,11 @@ void UpdateSession(PP_Instance instance, dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, - reference_id, + session_id, SerializedVarSendInput(dispatcher, response))); } -void ReleaseSession(PP_Instance instance, uint32_t reference_id) { +void ReleaseSession(PP_Instance instance, uint32_t session_id) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { NOTREACHED(); @@ -166,7 +164,7 @@ void ReleaseSession(PP_Instance instance, uint32_t reference_id) { } dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession( - API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, reference_id)); + API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, session_id)); } void Decrypt(PP_Instance instance, @@ -438,13 +436,13 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize( void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession( PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, SerializedVarReceiveInput type, SerializedVarReceiveInput init_data) { if (ppp_decryptor_impl_) { CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, instance, - reference_id, + session_id, ExtractReceivedVarAndAddRef(dispatcher(), &type), ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); } @@ -452,23 +450,23 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession( void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, SerializedVarReceiveInput response) { if (ppp_decryptor_impl_) { CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, instance, - reference_id, + session_id, ExtractReceivedVarAndAddRef(dispatcher(), &response)); } } void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession( PP_Instance instance, - uint32_t reference_id) { + uint32_t session_id) { if (ppp_decryptor_impl_) { CallWhileUnlocked(ppp_decryptor_impl_->ReleaseSession, instance, - reference_id); + session_id); } } diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.h b/ppapi/proxy/ppp_content_decryptor_private_proxy.h index 192ab5f..dfbcf4f 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.h +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.h @@ -33,13 +33,13 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy { void OnMsgInitialize(PP_Instance instance, SerializedVarReceiveInput key_system); void OnMsgCreateSession(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, SerializedVarReceiveInput type, SerializedVarReceiveInput init_data); void OnMsgUpdateSession(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, SerializedVarReceiveInput response); - void OnMsgReleaseSession(PP_Instance instance, uint32_t reference_id); + void OnMsgReleaseSession(PP_Instance instance, uint32_t session_id); void OnMsgDecrypt(PP_Instance instance, const PPPDecryptor_Buffer& encrypted_buffer, const std::string& serialized_encrypted_block_info); diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc index ad9ece9..e434f4f 100644 --- a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc +++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. // From private/ppb_content_decryptor_private.idl, -// modified Wed Nov 27 11:47:56 2013. +// modified Fri Dec 6 12:16:22 2013. #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" @@ -19,17 +19,17 @@ namespace thunk { namespace { void SessionCreated(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, struct PP_Var web_session_id) { VLOG(4) << "PPB_ContentDecryptor_Private::SessionCreated()"; EnterInstance enter(instance); if (enter.failed()) return; - enter.functions()->SessionCreated(instance, reference_id, web_session_id); + enter.functions()->SessionCreated(instance, session_id, web_session_id); } void SessionMessage(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, struct PP_Var message, struct PP_Var destination_url) { VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()"; @@ -37,29 +37,29 @@ void SessionMessage(PP_Instance instance, if (enter.failed()) return; enter.functions()->SessionMessage(instance, - reference_id, + session_id, message, destination_url); } -void SessionReady(PP_Instance instance, uint32_t reference_id) { +void SessionReady(PP_Instance instance, uint32_t session_id) { VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()"; EnterInstance enter(instance); if (enter.failed()) return; - enter.functions()->SessionReady(instance, reference_id); + enter.functions()->SessionReady(instance, session_id); } -void SessionClosed(PP_Instance instance, uint32_t reference_id) { +void SessionClosed(PP_Instance instance, uint32_t session_id) { VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()"; EnterInstance enter(instance); if (enter.failed()) return; - enter.functions()->SessionClosed(instance, reference_id); + enter.functions()->SessionClosed(instance, session_id); } void SessionError(PP_Instance instance, - uint32_t reference_id, + uint32_t session_id, int32_t media_error, int32_t system_code) { VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()"; @@ -67,7 +67,7 @@ void SessionError(PP_Instance instance, if (enter.failed()) return; enter.functions()->SessionError(instance, - reference_id, + session_id, media_error, system_code); } diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index 54636a3..bac3f97 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -143,16 +143,16 @@ class PPB_Instance_API { #if !defined(OS_NACL) // Content Decryptor. virtual void SessionCreated(PP_Instance instance, - uint32 reference_id, - PP_Var session_id) = 0; + uint32 session_id, + PP_Var web_session_id) = 0; virtual void SessionMessage(PP_Instance instance, - uint32 reference_id, + uint32 session_id, PP_Var message, PP_Var destination_url) = 0; - virtual void SessionReady(PP_Instance instance, uint32 reference_id) = 0; - virtual void SessionClosed(PP_Instance instance, uint32 reference_id) = 0; + virtual void SessionReady(PP_Instance instance, uint32 session_id) = 0; + virtual void SessionClosed(PP_Instance instance, uint32 session_id) = 0; virtual void SessionError(PP_Instance instance, - uint32 reference_id, + uint32 session_id, int32_t media_error, int32_t system_error) = 0; virtual void DeliverBlock(PP_Instance instance, |