| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/filters/decrypting_video_decoder.h" | 5 #include "media/filters/decrypting_video_decoder.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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 13 #include "media/base/bind_to_current_loop.h" | 14 #include "media/base/bind_to_current_loop.h" |
| 14 #include "media/base/cdm_context.h" | 15 #include "media/base/cdm_context.h" |
| 15 #include "media/base/decoder_buffer.h" | 16 #include "media/base/decoder_buffer.h" |
| 16 #include "media/base/media_log.h" | 17 #include "media/base/media_log.h" |
| 17 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 | 21 |
| 21 const char DecryptingVideoDecoder::kDecoderName[] = "DecryptingVideoDecoder"; | 22 const char DecryptingVideoDecoder::kDecoderName[] = "DecryptingVideoDecoder"; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 235 |
| 235 if (status == Decryptor::kError) { | 236 if (status == Decryptor::kError) { |
| 236 DVLOG(2) << "DeliverFrame() - kError"; | 237 DVLOG(2) << "DeliverFrame() - kError"; |
| 237 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decode error"; | 238 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decode error"; |
| 238 state_ = kError; | 239 state_ = kError; |
| 239 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); | 240 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); |
| 240 return; | 241 return; |
| 241 } | 242 } |
| 242 | 243 |
| 243 if (status == Decryptor::kNoKey) { | 244 if (status == Decryptor::kNoKey) { |
| 244 DVLOG(2) << "DeliverFrame() - kNoKey"; | 245 std::string key_id = |
| 245 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key"; | 246 scoped_pending_buffer_to_decode->decrypt_config()->key_id(); |
| 247 std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size()); |
| 248 DVLOG(1) << "DeliverFrame() - kNoKey, missing keyID " << missing_key_id; |
| 249 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 250 << ": no key, missing keyId " << missing_key_id; |
| 246 | 251 |
| 247 // Set |pending_buffer_to_decode_| back as we need to try decoding the | 252 // Set |pending_buffer_to_decode_| back as we need to try decoding the |
| 248 // pending buffer again when new key is added to the decryptor. | 253 // pending buffer again when new key is added to the decryptor. |
| 249 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; | 254 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; |
| 250 | 255 |
| 251 if (need_to_try_again_if_nokey_is_returned) { | 256 if (need_to_try_again_if_nokey_is_returned) { |
| 252 // The |state_| is still kPendingDecode. | 257 // The |state_| is still kPendingDecode. |
| 253 DecodePendingBuffer(); | 258 DecodePendingBuffer(); |
| 254 return; | 259 return; |
| 255 } | 260 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 305 } |
| 301 | 306 |
| 302 void DecryptingVideoDecoder::DoReset() { | 307 void DecryptingVideoDecoder::DoReset() { |
| 303 DCHECK(init_cb_.is_null()); | 308 DCHECK(init_cb_.is_null()); |
| 304 DCHECK(decode_cb_.is_null()); | 309 DCHECK(decode_cb_.is_null()); |
| 305 state_ = kIdle; | 310 state_ = kIdle; |
| 306 base::ResetAndReturn(&reset_cb_).Run(); | 311 base::ResetAndReturn(&reset_cb_).Run(); |
| 307 } | 312 } |
| 308 | 313 |
| 309 } // namespace media | 314 } // namespace media |
| OLD | NEW |