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

Side by Side Diff: media/base/android/media_drm_bridge.cc

Issue 1160983002: Allows support for persistent session types in BrowserCdm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adds extra checks to address ddorwin's comments Created 5 years, 6 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
« no previous file with comments | « content/renderer/media/crypto/renderer_cdm_manager.cc ('k') | media/base/media_keys.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "media/base/android/media_drm_bridge.h" 5 #include "media/base/android/media_drm_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 310
311 void MediaDrmBridge::CreateSessionAndGenerateRequest( 311 void MediaDrmBridge::CreateSessionAndGenerateRequest(
312 SessionType session_type, 312 SessionType session_type,
313 media::EmeInitDataType init_data_type, 313 media::EmeInitDataType init_data_type,
314 const std::vector<uint8_t>& init_data, 314 const std::vector<uint8_t>& init_data,
315 scoped_ptr<media::NewSessionCdmPromise> promise) { 315 scoped_ptr<media::NewSessionCdmPromise> promise) {
316 DVLOG(1) << __FUNCTION__; 316 DVLOG(1) << __FUNCTION__;
317 317
318 if (session_type != media::MediaKeys::TEMPORARY_SESSION) { 318 if (session_type != media::MediaKeys::TEMPORARY_SESSION) {
319 NOTREACHED() << "EME persistent sessions not yet supported on Android.";
ddorwin 2015/05/29 02:13:59 On second thought, since that code could in theory
gunsch 2015/05/29 16:40:10 Done.
319 promise->reject(NOT_SUPPORTED_ERROR, 0, 320 promise->reject(NOT_SUPPORTED_ERROR, 0,
320 "Only the temporary session type is supported."); 321 "Only the temporary session type is supported.");
321 return; 322 return;
322 } 323 }
323 324
324 JNIEnv* env = AttachCurrentThread(); 325 JNIEnv* env = AttachCurrentThread();
325 ScopedJavaLocalRef<jbyteArray> j_init_data; 326 ScopedJavaLocalRef<jbyteArray> j_init_data;
326 ScopedJavaLocalRef<jobjectArray> j_optional_parameters; 327 ScopedJavaLocalRef<jobjectArray> j_optional_parameters;
327 328
328 MediaClientAndroid* client = GetMediaClientAndroid(); 329 MediaClientAndroid* client = GetMediaClientAndroid();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 Java_MediaDrmBridge_createSessionFromNative(env, j_media_drm_.obj(), 361 Java_MediaDrmBridge_createSessionFromNative(env, j_media_drm_.obj(),
361 j_init_data.obj(), j_mime.obj(), 362 j_init_data.obj(), j_mime.obj(),
362 j_optional_parameters.obj(), 363 j_optional_parameters.obj(),
363 promise_id); 364 promise_id);
364 } 365 }
365 366
366 void MediaDrmBridge::LoadSession( 367 void MediaDrmBridge::LoadSession(
367 SessionType session_type, 368 SessionType session_type,
368 const std::string& session_id, 369 const std::string& session_id,
369 scoped_ptr<media::NewSessionCdmPromise> promise) { 370 scoped_ptr<media::NewSessionCdmPromise> promise) {
371 NOTREACHED() << "EME persistent sessions not yet supported on Android.";
370 promise->reject(NOT_SUPPORTED_ERROR, 0, "LoadSession() is not supported."); 372 promise->reject(NOT_SUPPORTED_ERROR, 0, "LoadSession() is not supported.");
371 } 373 }
372 374
373 void MediaDrmBridge::UpdateSession( 375 void MediaDrmBridge::UpdateSession(
374 const std::string& session_id, 376 const std::string& session_id,
375 const std::vector<uint8_t>& response, 377 const std::vector<uint8_t>& response,
376 scoped_ptr<media::SimpleCdmPromise> promise) { 378 scoped_ptr<media::SimpleCdmPromise> promise) {
377 DVLOG(1) << __FUNCTION__; 379 DVLOG(1) << __FUNCTION__;
378 380
379 JNIEnv* env = AttachCurrentThread(); 381 JNIEnv* env = AttachCurrentThread();
(...skipping 15 matching lines...) Expand all
395 env, reinterpret_cast<const uint8_t*>(session_id.data()), 397 env, reinterpret_cast<const uint8_t*>(session_id.data()),
396 session_id.size()); 398 session_id.size());
397 uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass()); 399 uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass());
398 Java_MediaDrmBridge_closeSession(env, j_media_drm_.obj(), j_session_id.obj(), 400 Java_MediaDrmBridge_closeSession(env, j_media_drm_.obj(), j_session_id.obj(),
399 promise_id); 401 promise_id);
400 } 402 }
401 403
402 void MediaDrmBridge::RemoveSession( 404 void MediaDrmBridge::RemoveSession(
403 const std::string& session_id, 405 const std::string& session_id,
404 scoped_ptr<media::SimpleCdmPromise> promise) { 406 scoped_ptr<media::SimpleCdmPromise> promise) {
407 NOTREACHED() << "EME persistent sessions not yet supported on Android.";
405 promise->reject(NOT_SUPPORTED_ERROR, 0, "RemoveSession() is not supported."); 408 promise->reject(NOT_SUPPORTED_ERROR, 0, "RemoveSession() is not supported.");
406 } 409 }
407 410
408 CdmContext* MediaDrmBridge::GetCdmContext() { 411 CdmContext* MediaDrmBridge::GetCdmContext() {
409 NOTREACHED(); 412 NOTREACHED();
410 return nullptr; 413 return nullptr;
411 } 414 }
412 415
413 int MediaDrmBridge::RegisterPlayer(const base::Closure& new_key_cb, 416 int MediaDrmBridge::RegisterPlayer(const base::Closure& new_key_cb,
414 const base::Closure& cdm_unset_cb) { 417 const base::Closure& cdm_unset_cb) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 JNIEnv* env = AttachCurrentThread(); 550 JNIEnv* env = AttachCurrentThread();
548 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); 551 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj());
549 } 552 }
550 553
551 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( 554 void MediaDrmBridge::OnResetDeviceCredentialsCompleted(
552 JNIEnv* env, jobject, bool success) { 555 JNIEnv* env, jobject, bool success) {
553 base::ResetAndReturn(&reset_credentials_cb_).Run(success); 556 base::ResetAndReturn(&reset_credentials_cb_).Run(success);
554 } 557 }
555 558
556 } // namespace media 559 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/renderer_cdm_manager.cc ('k') | media/base/media_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698