| 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_demuxer_stream.h" | 5 #include "media/filters/decrypting_demuxer_stream.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 "media/base/bind_to_current_loop.h" | 13 #include "media/base/bind_to_current_loop.h" |
| 13 #include "media/base/decoder_buffer.h" | 14 #include "media/base/decoder_buffer.h" |
| 14 #include "media/base/media_log.h" | 15 #include "media/base/media_log.h" |
| 15 #include "media/base/media_util.h" | 16 #include "media/base/media_util.h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| 18 | 19 |
| 19 static bool IsStreamValidAndEncrypted(DemuxerStream* stream) { | 20 static bool IsStreamValidAndEncrypted(DemuxerStream* stream) { |
| 20 return ((stream->type() == DemuxerStream::AUDIO && | 21 return ((stream->type() == DemuxerStream::AUDIO && |
| 21 stream->audio_decoder_config().IsValidConfig() && | 22 stream->audio_decoder_config().IsValidConfig() && |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (status == Decryptor::kError) { | 290 if (status == Decryptor::kError) { |
| 290 DVLOG(2) << "DoDeliverBuffer() - kError"; | 291 DVLOG(2) << "DoDeliverBuffer() - kError"; |
| 291 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decrypt error"; | 292 MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decrypt error"; |
| 292 pending_buffer_to_decrypt_ = NULL; | 293 pending_buffer_to_decrypt_ = NULL; |
| 293 state_ = kIdle; | 294 state_ = kIdle; |
| 294 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); | 295 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| 295 return; | 296 return; |
| 296 } | 297 } |
| 297 | 298 |
| 298 if (status == Decryptor::kNoKey) { | 299 if (status == Decryptor::kNoKey) { |
| 299 DVLOG(2) << "DoDeliverBuffer() - kNoKey"; | 300 std::string key_id = pending_buffer_to_decrypt_->decrypt_config()->key_id(); |
| 300 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key"; | 301 std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size()); |
| 302 DVLOG(1) << "DeliverBuffer() - no key for key ID " << missing_key_id; |
| 303 MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID " |
| 304 << missing_key_id; |
| 305 |
| 301 if (need_to_try_again_if_nokey) { | 306 if (need_to_try_again_if_nokey) { |
| 302 // The |state_| is still kPendingDecrypt. | 307 // The |state_| is still kPendingDecrypt. |
| 303 DecryptPendingBuffer(); | 308 DecryptPendingBuffer(); |
| 304 return; | 309 return; |
| 305 } | 310 } |
| 306 | 311 |
| 307 state_ = kWaitingForKey; | 312 state_ = kWaitingForKey; |
| 308 waiting_for_decryption_key_cb_.Run(); | 313 waiting_for_decryption_key_cb_.Run(); |
| 309 return; | 314 return; |
| 310 } | 315 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 break; | 388 break; |
| 384 } | 389 } |
| 385 | 390 |
| 386 default: | 391 default: |
| 387 NOTREACHED(); | 392 NOTREACHED(); |
| 388 return; | 393 return; |
| 389 } | 394 } |
| 390 } | 395 } |
| 391 | 396 |
| 392 } // namespace media | 397 } // namespace media |
| OLD | NEW |