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

Side by Side Diff: media/base/android/media_codec_loop.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_codec_loop.h" 5 #include "media/base/android/media_codec_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/bind_to_current_loop.h" 10 #include "media/base/bind_to_current_loop.h"
(...skipping 21 matching lines...) Expand all
32 MediaCodecLoop::InputData::InputData() {} 32 MediaCodecLoop::InputData::InputData() {}
33 33
34 MediaCodecLoop::InputData::InputData(const InputData& other) 34 MediaCodecLoop::InputData::InputData(const InputData& other)
35 : memory(other.memory), 35 : memory(other.memory),
36 length(other.length), 36 length(other.length),
37 key_id(other.key_id), 37 key_id(other.key_id),
38 iv(other.iv), 38 iv(other.iv),
39 subsamples(other.subsamples), 39 subsamples(other.subsamples),
40 presentation_time(other.presentation_time), 40 presentation_time(other.presentation_time),
41 is_eos(other.is_eos), 41 is_eos(other.is_eos),
42 is_encrypted(other.is_encrypted) {} 42 encryption_scheme(other.encryption_scheme) {}
43 43
44 MediaCodecLoop::InputData::~InputData() {} 44 MediaCodecLoop::InputData::~InputData() {}
45 45
46 MediaCodecLoop::MediaCodecLoop( 46 MediaCodecLoop::MediaCodecLoop(
47 int sdk_int, 47 int sdk_int,
48 Client* client, 48 Client* client,
49 std::unique_ptr<MediaCodecBridge> media_codec, 49 std::unique_ptr<MediaCodecBridge> media_codec,
50 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 50 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
51 : state_(STATE_READY), 51 : state_(STATE_READY),
52 client_(client), 52 client_(client),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 if (input_data.is_eos) { 193 if (input_data.is_eos) {
194 media_codec_->QueueEOS(input_buffer.index); 194 media_codec_->QueueEOS(input_buffer.index);
195 SetState(STATE_DRAINING); 195 SetState(STATE_DRAINING);
196 client_->OnInputDataQueued(true); 196 client_->OnInputDataQueued(true);
197 return; 197 return;
198 } 198 }
199 199
200 media::MediaCodecStatus status = MEDIA_CODEC_OK; 200 media::MediaCodecStatus status = MEDIA_CODEC_OK;
201 201
202 if (input_data.is_encrypted) { 202 if (input_data.encryption_scheme.is_encrypted()) {
203 // Note that input_data might not have a valid memory ptr if this is a 203 // Note that input_data might not have a valid memory ptr if this is a
204 // re-send of a buffer that was sent before decryption keys arrived. 204 // re-send of a buffer that was sent before decryption keys arrived.
205 205
206 status = media_codec_->QueueSecureInputBuffer( 206 status = media_codec_->QueueSecureInputBuffer(
207 input_buffer.index, input_data.memory, input_data.length, 207 input_buffer.index, input_data.memory, input_data.length,
208 input_data.key_id, input_data.iv, input_data.subsamples, 208 input_data.key_id, input_data.iv, input_data.subsamples,
209 input_data.presentation_time); 209 input_data.encryption_scheme, input_data.presentation_time);
210 210
211 } else { 211 } else {
212 status = media_codec_->QueueInputBuffer( 212 status = media_codec_->QueueInputBuffer(
213 input_buffer.index, input_data.memory, input_data.length, 213 input_buffer.index, input_data.memory, input_data.length,
214 input_data.presentation_time); 214 input_data.presentation_time);
215 } 215 }
216 216
217 switch (status) { 217 switch (status) {
218 case MEDIA_CODEC_ERROR: 218 case MEDIA_CODEC_ERROR:
219 DLOG(ERROR) << __func__ << ": MEDIA_CODEC_ERROR from QueueInputBuffer"; 219 DLOG(ERROR) << __func__ << ": MEDIA_CODEC_ERROR from QueueInputBuffer";
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 RETURN_STRING(STATE_DRAINED); 369 RETURN_STRING(STATE_DRAINED);
370 RETURN_STRING(STATE_ERROR); 370 RETURN_STRING(STATE_ERROR);
371 } 371 }
372 #undef RETURN_STRING 372 #undef RETURN_STRING
373 373
374 NOTREACHED() << "Unknown state " << state; 374 NOTREACHED() << "Unknown state " << state;
375 return nullptr; 375 return nullptr;
376 } 376 }
377 377
378 } // namespace media 378 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698