| 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" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 if (status == Decryptor::kNoKey) { | 299 if (status == Decryptor::kNoKey) { |
| 300 std::string key_id = pending_buffer_to_decrypt_->decrypt_config()->key_id(); | 300 std::string key_id = pending_buffer_to_decrypt_->decrypt_config()->key_id(); |
| 301 std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size()); | 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; | 302 DVLOG(1) << "DeliverBuffer() - no key for key ID " << missing_key_id; |
| 303 MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID " | 303 MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID " |
| 304 << missing_key_id; | 304 << missing_key_id; |
| 305 | 305 |
| 306 if (need_to_try_again_if_nokey) { | 306 if (need_to_try_again_if_nokey) { |
| 307 // The |state_| is still kPendingDecrypt. | 307 // The |state_| is still kPendingDecrypt. |
| 308 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 309 << ": key was added, resuming decrypt"; |
| 308 DecryptPendingBuffer(); | 310 DecryptPendingBuffer(); |
| 309 return; | 311 return; |
| 310 } | 312 } |
| 311 | 313 |
| 312 state_ = kWaitingForKey; | 314 state_ = kWaitingForKey; |
| 313 waiting_for_decryption_key_cb_.Run(); | 315 waiting_for_decryption_key_cb_.Run(); |
| 314 return; | 316 return; |
| 315 } | 317 } |
| 316 | 318 |
| 317 DCHECK_EQ(status, Decryptor::kSuccess); | 319 DCHECK_EQ(status, Decryptor::kSuccess); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 328 | 330 |
| 329 void DecryptingDemuxerStream::OnKeyAdded() { | 331 void DecryptingDemuxerStream::OnKeyAdded() { |
| 330 DCHECK(task_runner_->BelongsToCurrentThread()); | 332 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 331 | 333 |
| 332 if (state_ == kPendingDecrypt) { | 334 if (state_ == kPendingDecrypt) { |
| 333 key_added_while_decrypt_pending_ = true; | 335 key_added_while_decrypt_pending_ = true; |
| 334 return; | 336 return; |
| 335 } | 337 } |
| 336 | 338 |
| 337 if (state_ == kWaitingForKey) { | 339 if (state_ == kWaitingForKey) { |
| 340 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 341 << ": key added, resuming decrypt"; |
| 338 state_ = kPendingDecrypt; | 342 state_ = kPendingDecrypt; |
| 339 DecryptPendingBuffer(); | 343 DecryptPendingBuffer(); |
| 340 } | 344 } |
| 341 } | 345 } |
| 342 | 346 |
| 343 void DecryptingDemuxerStream::DoReset() { | 347 void DecryptingDemuxerStream::DoReset() { |
| 344 DCHECK(state_ != kUninitialized); | 348 DCHECK(state_ != kUninitialized); |
| 345 DCHECK(init_cb_.is_null()); | 349 DCHECK(init_cb_.is_null()); |
| 346 DCHECK(read_cb_.is_null()); | 350 DCHECK(read_cb_.is_null()); |
| 347 | 351 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 break; | 392 break; |
| 389 } | 393 } |
| 390 | 394 |
| 391 default: | 395 default: |
| 392 NOTREACHED(); | 396 NOTREACHED(); |
| 393 return; | 397 return; |
| 394 } | 398 } |
| 395 } | 399 } |
| 396 | 400 |
| 397 } // namespace media | 401 } // namespace media |
| OLD | NEW |