OLD | NEW |
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 Loading... |
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 NOTIMPLEMENTED() << "EME persistent sessions not yet supported on Android."; |
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 Loading... |
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 NOTIMPLEMENTED() << "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 Loading... |
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 NOTIMPLEMENTED() << "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 Loading... |
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 |
OLD | NEW |