| OLD | NEW |
| 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 Loading... |
| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 if (input_data.is_eos) { | 194 if (input_data.is_eos) { |
| 195 media_codec_->QueueEOS(input_buffer.index); | 195 media_codec_->QueueEOS(input_buffer.index); |
| 196 SetState(STATE_DRAINING); | 196 SetState(STATE_DRAINING); |
| 197 client_->OnInputDataQueued(true); | 197 client_->OnInputDataQueued(true); |
| 198 return; | 198 return; |
| 199 } | 199 } |
| 200 | 200 |
| 201 media::MediaCodecStatus status = MEDIA_CODEC_OK; | 201 media::MediaCodecStatus status = MEDIA_CODEC_OK; |
| 202 | 202 |
| 203 if (input_data.is_encrypted) { | 203 if (input_data.encryption_scheme.is_encrypted()) { |
| 204 // Note that input_data might not have a valid memory ptr if this is a | 204 // Note that input_data might not have a valid memory ptr if this is a |
| 205 // re-send of a buffer that was sent before decryption keys arrived. | 205 // re-send of a buffer that was sent before decryption keys arrived. |
| 206 | 206 |
| 207 status = media_codec_->QueueSecureInputBuffer( | 207 status = media_codec_->QueueSecureInputBuffer( |
| 208 input_buffer.index, input_data.memory, input_data.length, | 208 input_buffer.index, input_data.memory, input_data.length, |
| 209 input_data.key_id, input_data.iv, input_data.subsamples, | 209 input_data.key_id, input_data.iv, input_data.subsamples, |
| 210 input_data.presentation_time); | 210 input_data.encryption_scheme, input_data.presentation_time); |
| 211 | 211 |
| 212 } else { | 212 } else { |
| 213 status = media_codec_->QueueInputBuffer( | 213 status = media_codec_->QueueInputBuffer( |
| 214 input_buffer.index, input_data.memory, input_data.length, | 214 input_buffer.index, input_data.memory, input_data.length, |
| 215 input_data.presentation_time); | 215 input_data.presentation_time); |
| 216 } | 216 } |
| 217 | 217 |
| 218 switch (status) { | 218 switch (status) { |
| 219 case MEDIA_CODEC_ERROR: | 219 case MEDIA_CODEC_ERROR: |
| 220 DLOG(ERROR) << __FUNCTION__ | 220 DLOG(ERROR) << __FUNCTION__ |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 RETURN_STRING(STATE_DRAINED); | 372 RETURN_STRING(STATE_DRAINED); |
| 373 RETURN_STRING(STATE_ERROR); | 373 RETURN_STRING(STATE_ERROR); |
| 374 } | 374 } |
| 375 #undef RETURN_STRING | 375 #undef RETURN_STRING |
| 376 | 376 |
| 377 NOTREACHED() << "Unknown state " << state; | 377 NOTREACHED() << "Unknown state " << state; |
| 378 return nullptr; | 378 return nullptr; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace media | 381 } // namespace media |
| OLD | NEW |