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_audio_decoder.h" | 5 #include "media/filters/decrypting_audio_decoder.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/string_number_conversions.h" |
16 #include "media/base/audio_buffer.h" | 17 #include "media/base/audio_buffer.h" |
17 #include "media/base/audio_decoder_config.h" | 18 #include "media/base/audio_decoder_config.h" |
18 #include "media/base/audio_timestamp_helper.h" | 19 #include "media/base/audio_timestamp_helper.h" |
19 #include "media/base/bind_to_current_loop.h" | 20 #include "media/base/bind_to_current_loop.h" |
20 #include "media/base/cdm_context.h" | 21 #include "media/base/cdm_context.h" |
21 #include "media/base/decoder_buffer.h" | 22 #include "media/base/decoder_buffer.h" |
22 #include "media/base/media_log.h" | 23 #include "media/base/media_log.h" |
23 #include "media/base/timestamp_constants.h" | 24 #include "media/base/timestamp_constants.h" |
24 | 25 |
25 namespace media { | 26 namespace media { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 258 |
258 if (status == Decryptor::kError) { | 259 if (status == Decryptor::kError) { |
259 DVLOG(2) << "DeliverFrame() - kError"; | 260 DVLOG(2) << "DeliverFrame() - kError"; |
260 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decode error"; | 261 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decode error"; |
261 state_ = kDecodeFinished; // TODO add kError state | 262 state_ = kDecodeFinished; // TODO add kError state |
262 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); | 263 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); |
263 return; | 264 return; |
264 } | 265 } |
265 | 266 |
266 if (status == Decryptor::kNoKey) { | 267 if (status == Decryptor::kNoKey) { |
267 DVLOG(2) << "DeliverFrame() - kNoKey"; | 268 std::string key_id = |
268 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key"; | 269 scoped_pending_buffer_to_decode->decrypt_config()->key_id(); |
| 270 std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size()); |
| 271 DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id; |
| 272 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key for key ID " |
| 273 << missing_key_id; |
269 | 274 |
270 // Set |pending_buffer_to_decode_| back as we need to try decoding the | 275 // Set |pending_buffer_to_decode_| back as we need to try decoding the |
271 // pending buffer again when new key is added to the decryptor. | 276 // pending buffer again when new key is added to the decryptor. |
272 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; | 277 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; |
273 | 278 |
274 if (need_to_try_again_if_nokey_is_returned) { | 279 if (need_to_try_again_if_nokey_is_returned) { |
275 // The |state_| is still kPendingDecode. | 280 // The |state_| is still kPendingDecode. |
276 DecodePendingBuffer(); | 281 DecodePendingBuffer(); |
277 return; | 282 return; |
278 } | 283 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 352 } |
348 | 353 |
349 frame->set_timestamp(current_time); | 354 frame->set_timestamp(current_time); |
350 timestamp_helper_->AddFrames(frame->frame_count()); | 355 timestamp_helper_->AddFrames(frame->frame_count()); |
351 | 356 |
352 output_cb_.Run(frame); | 357 output_cb_.Run(frame); |
353 } | 358 } |
354 } | 359 } |
355 | 360 |
356 } // namespace media | 361 } // namespace media |
OLD | NEW |