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

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

Issue 1113023004: MediaDrmBridge: only use delegate init data if non-empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 MediaDrmBridgeDelegate* delegate = 319 MediaDrmBridgeDelegate* delegate =
320 client->GetMediaDrmBridgeDelegate(scheme_uuid_); 320 client->GetMediaDrmBridgeDelegate(scheme_uuid_);
321 if (delegate) { 321 if (delegate) {
322 std::vector<uint8> init_data_from_delegate; 322 std::vector<uint8> init_data_from_delegate;
323 std::vector<std::string> optional_parameters_from_delegate; 323 std::vector<std::string> optional_parameters_from_delegate;
324 if (!delegate->OnCreateSession(init_data_type, init_data, 324 if (!delegate->OnCreateSession(init_data_type, init_data,
325 &init_data_from_delegate, 325 &init_data_from_delegate,
326 &optional_parameters_from_delegate)) { 326 &optional_parameters_from_delegate)) {
327 promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data."); 327 promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data.");
328 } 328 }
329 j_init_data = base::android::ToJavaByteArray( 329 if (!init_data_from_delegate.empty()) {
330 env, vector_as_array(&init_data_from_delegate), 330 j_init_data = base::android::ToJavaByteArray(
331 init_data_from_delegate.size()); 331 env, vector_as_array(&init_data_from_delegate),
332 init_data_from_delegate.size());
333 }
332 if (!optional_parameters_from_delegate.empty()) { 334 if (!optional_parameters_from_delegate.empty()) {
333 j_optional_parameters = base::android::ToJavaArrayOfStrings( 335 j_optional_parameters = base::android::ToJavaArrayOfStrings(
334 env, optional_parameters_from_delegate); 336 env, optional_parameters_from_delegate);
335 } 337 }
336 } 338 }
337 } 339 }
338 340
339 if (j_init_data.is_null()) { 341 if (j_init_data.is_null()) {
340 j_init_data = base::android::ToJavaByteArray( 342 j_init_data = base::android::ToJavaByteArray(
341 env, vector_as_array(&init_data), init_data.size()); 343 env, vector_as_array(&init_data), init_data.size());
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 JNIEnv* env = AttachCurrentThread(); 536 JNIEnv* env = AttachCurrentThread();
535 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); 537 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj());
536 } 538 }
537 539
538 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( 540 void MediaDrmBridge::OnResetDeviceCredentialsCompleted(
539 JNIEnv* env, jobject, bool success) { 541 JNIEnv* env, jobject, bool success) {
540 base::ResetAndReturn(&reset_credentials_cb_).Run(success); 542 base::ResetAndReturn(&reset_credentials_cb_).Run(success);
541 } 543 }
542 544
543 } // namespace media 545 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698