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

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

Issue 2058113002: Add 'cbcs' encryption scheme support in Android media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years 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
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/sdk_media_codec_bridge.h" 5 #include "media/base/android/sdk_media_codec_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // TODO(timav): Combine this and above methods together keeping only the first 175 // TODO(timav): Combine this and above methods together keeping only the first
176 // interface after we switch to Spitzer pipeline. 176 // interface after we switch to Spitzer pipeline.
177 MediaCodecStatus SdkMediaCodecBridge::QueueSecureInputBuffer( 177 MediaCodecStatus SdkMediaCodecBridge::QueueSecureInputBuffer(
178 int index, 178 int index,
179 const uint8_t* data, 179 const uint8_t* data,
180 size_t data_size, 180 size_t data_size,
181 const std::vector<char>& key_id, 181 const std::vector<char>& key_id,
182 const std::vector<char>& iv, 182 const std::vector<char>& iv,
183 const SubsampleEntry* subsamples, 183 const SubsampleEntry* subsamples,
184 int subsamples_size, 184 int subsamples_size,
185 const EncryptionScheme& encryption_scheme,
185 base::TimeDelta presentation_time) { 186 base::TimeDelta presentation_time) {
186 DVLOG(3) << __func__ << index << ": " << data_size; 187 DVLOG(3) << __func__ << index << ": " << data_size;
187 if (data_size > 188 if (data_size >
188 base::checked_cast<size_t>(std::numeric_limits<int32_t>::max())) { 189 base::checked_cast<size_t>(std::numeric_limits<int32_t>::max())) {
189 return MEDIA_CODEC_ERROR; 190 return MEDIA_CODEC_ERROR;
190 } 191 }
191 if (data && !FillInputBuffer(index, data, data_size)) 192 if (data && !FillInputBuffer(index, data, data_size))
192 return MEDIA_CODEC_ERROR; 193 return MEDIA_CODEC_ERROR;
193 194
194 JNIEnv* env = AttachCurrentThread(); 195 JNIEnv* env = AttachCurrentThread();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 228
228 ScopedJavaLocalRef<jintArray> clear_array = 229 ScopedJavaLocalRef<jintArray> clear_array =
229 ToJavaIntArray(env, std::move(native_clear_array), new_subsamples_size); 230 ToJavaIntArray(env, std::move(native_clear_array), new_subsamples_size);
230 ScopedJavaLocalRef<jintArray> cypher_array = 231 ScopedJavaLocalRef<jintArray> cypher_array =
231 ToJavaIntArray(env, std::move(native_cypher_array), new_subsamples_size); 232 ToJavaIntArray(env, std::move(native_cypher_array), new_subsamples_size);
232 233
233 return static_cast<MediaCodecStatus>( 234 return static_cast<MediaCodecStatus>(
234 Java_MediaCodecBridge_queueSecureInputBuffer( 235 Java_MediaCodecBridge_queueSecureInputBuffer(
235 env, j_media_codec_.obj(), index, 0, j_iv.obj(), j_key_id.obj(), 236 env, j_media_codec_.obj(), index, 0, j_iv.obj(), j_key_id.obj(),
236 clear_array, cypher_array, new_subsamples_size, 237 clear_array, cypher_array, new_subsamples_size,
238 static_cast<int>(encryption_scheme.mode()),
239 static_cast<int>(encryption_scheme.pattern().encrypt_blocks()),
240 static_cast<int>(encryption_scheme.pattern().skip_blocks()),
237 presentation_time.InMicroseconds())); 241 presentation_time.InMicroseconds()));
238 } 242 }
239 243
240 void SdkMediaCodecBridge::QueueEOS(int input_buffer_index) { 244 void SdkMediaCodecBridge::QueueEOS(int input_buffer_index) {
241 DVLOG(3) << __func__ << ": " << input_buffer_index; 245 DVLOG(3) << __func__ << ": " << input_buffer_index;
242 JNIEnv* env = AttachCurrentThread(); 246 JNIEnv* env = AttachCurrentThread();
243 Java_MediaCodecBridge_queueInputBuffer( 247 Java_MediaCodecBridge_queueInputBuffer(
244 env, j_media_codec_, input_buffer_index, 0, 0, 0, kBufferFlagEndOfStream); 248 env, j_media_codec_, input_buffer_index, 0, 0, 0, kBufferFlagEndOfStream);
245 } 249 }
246 250
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 if (adaptive_playback_supported_for_testing_ == 0) 680 if (adaptive_playback_supported_for_testing_ == 0)
677 return false; 681 return false;
678 else if (adaptive_playback_supported_for_testing_ > 0) 682 else if (adaptive_playback_supported_for_testing_ > 0)
679 return true; 683 return true;
680 JNIEnv* env = AttachCurrentThread(); 684 JNIEnv* env = AttachCurrentThread();
681 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), 685 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(),
682 width, height); 686 width, height);
683 } 687 }
684 688
685 } // namespace media 689 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698