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

Side by Side Diff: content/browser/media/android/browser_media_player_manager.cc

Issue 131653003: Support LoadSession() in MediaKeys and PPP_ContentDecryptor_Private interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/android/browser_media_player_manager.h" 5 #include "content/browser/media/android/browser_media_player_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/android/content_view_core_impl.h" 8 #include "content/browser/android/content_view_core_impl.h"
9 #include "content/browser/media/android/browser_demuxer_android.h" 9 #include "content/browser/media/android/browser_demuxer_android.h"
10 #include "content/browser/media/android/media_resource_getter_impl.h" 10 #include "content/browser/media/android/media_resource_getter_impl.h"
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 599
600 AddDrmBridge(media_keys_id, uuid, frame_url); 600 AddDrmBridge(media_keys_id, uuid, frame_url);
601 // In EME v0.1b MediaKeys lives in the media element. So the |media_keys_id| 601 // In EME v0.1b MediaKeys lives in the media element. So the |media_keys_id|
602 // is the same as the |player_id|. 602 // is the same as the |player_id|.
603 OnSetMediaKeys(media_keys_id, media_keys_id); 603 OnSetMediaKeys(media_keys_id, media_keys_id);
604 } 604 }
605 605
606 void BrowserMediaPlayerManager::OnCreateSession( 606 void BrowserMediaPlayerManager::OnCreateSession(
607 int media_keys_id, 607 int media_keys_id,
608 uint32 session_id, 608 uint32 session_id,
609 MediaKeysHostMsg_CreateSession_Type type, 609 MediaKeysHostMsg_CreateSession_Type content_type,
610 const std::vector<uint8>& init_data) { 610 const std::vector<uint8>& init_data) {
611 if (init_data.size() > kEmeInitDataMaximum) { 611 if (init_data.size() > kEmeInitDataMaximum) {
612 LOG(WARNING) << "InitData for ID: " << media_keys_id 612 LOG(WARNING) << "InitData for ID: " << media_keys_id
613 << " too long: " << init_data.size(); 613 << " too long: " << init_data.size();
614 OnSessionError( 614 OnSessionError(
615 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); 615 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0);
616 return; 616 return;
617 } 617 }
618 618
619 // Convert the session type into a MIME type. "audio" and "video" don't 619 // Convert the session content type into a MIME type. "audio" and "video"
620 // matter, so using "video" for the MIME type. 620 // don't matter, so using "video" for the MIME type.
621 // Ref: https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypt ed-media.html#dom-createsession 621 // Ref:
622 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypte d-media.html#dom-createsession
622 std::string mime_type; 623 std::string mime_type;
623 switch (type) { 624 switch (content_type) {
624 case CREATE_SESSION_TYPE_WEBM: 625 case CREATE_SESSION_TYPE_WEBM:
625 mime_type = "video/webm"; 626 mime_type = "video/webm";
626 break; 627 break;
627 case CREATE_SESSION_TYPE_MP4: 628 case CREATE_SESSION_TYPE_MP4:
628 mime_type = "video/mp4"; 629 mime_type = "video/mp4";
629 break; 630 break;
630 default: 631 default:
631 NOTREACHED(); 632 NOTREACHED();
632 return; 633 return;
633 } 634 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 return; 816 return;
816 } 817 }
817 // TODO(qinmin): add the logic to decide whether we should create the 818 // TODO(qinmin): add the logic to decide whether we should create the
818 // fullscreen surface for EME lv1. 819 // fullscreen surface for EME lv1.
819 player->SetDrmBridge(drm_bridge); 820 player->SetDrmBridge(drm_bridge);
820 } 821 }
821 822
822 void BrowserMediaPlayerManager::CreateSessionIfPermitted( 823 void BrowserMediaPlayerManager::CreateSessionIfPermitted(
823 int media_keys_id, 824 int media_keys_id,
824 uint32 session_id, 825 uint32 session_id,
825 const std::string& type, 826 const std::string& content_type,
826 const std::vector<uint8>& init_data, 827 const std::vector<uint8>& init_data,
827 bool permitted) { 828 bool permitted) {
828 if (!permitted) { 829 if (!permitted) {
829 OnSessionError( 830 OnSessionError(
830 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); 831 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0);
831 return; 832 return;
832 } 833 }
833 834
834 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id); 835 MediaDrmBridge* drm_bridge = GetDrmBridge(media_keys_id);
835 if (!drm_bridge) { 836 if (!drm_bridge) {
836 DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found"; 837 DLOG(WARNING) << "No MediaDrmBridge for ID: " << media_keys_id << " found";
837 OnSessionError( 838 OnSessionError(
838 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0); 839 media_keys_id, session_id, media::MediaKeys::kUnknownError, 0);
839 return; 840 return;
840 } 841 }
841 media_keys_ids_pending_approval_.erase(media_keys_id); 842 media_keys_ids_pending_approval_.erase(media_keys_id);
842 media_keys_ids_approved_.insert(media_keys_id); 843 media_keys_ids_approved_.insert(media_keys_id);
843 drm_bridge->CreateSession(session_id, type, &init_data[0], init_data.size()); 844
845 if (!drm_bridge->CreateSession(
846 session_id, content_type, &init_data[0], init_data.size())) {
847 return;
848 }
849
850 // TODO(xhwang): Move the following code to OnSessionReady.
844 851
845 // TODO(qinmin): currently |media_keys_id| and player ID are identical. 852 // TODO(qinmin): currently |media_keys_id| and player ID are identical.
846 // This might not be true in the future. 853 // This might not be true in the future.
847 if (pending_fullscreen_player_id_ != media_keys_id) 854 if (pending_fullscreen_player_id_ != media_keys_id)
848 return; 855 return;
849 856
850 pending_fullscreen_player_id_ = -1; 857 pending_fullscreen_player_id_ = -1;
851 MediaPlayerAndroid* player = GetPlayer(media_keys_id); 858 MediaPlayerAndroid* player = GetPlayer(media_keys_id);
852 if (player->IsPlaying()) 859 if (player->IsPlaying())
853 OnProtectedSurfaceRequested(media_keys_id); 860 OnProtectedSurfaceRequested(media_keys_id);
854 } 861 }
855 862
856 void BrowserMediaPlayerManager::ReleaseFullscreenPlayer( 863 void BrowserMediaPlayerManager::ReleaseFullscreenPlayer(
857 MediaPlayerAndroid* player) { 864 MediaPlayerAndroid* player) {
858 player->Release(); 865 player->Release();
859 } 866 }
860 867
861 } // namespace content 868 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/android/browser_media_player_manager.h ('k') | content/renderer/media/android/proxy_media_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698