| 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" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id; | 248 DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id; |
| 249 MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID " | 249 MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID " |
| 250 << missing_key_id; | 250 << missing_key_id; |
| 251 | 251 |
| 252 // 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 |
| 253 // pending buffer again when new key is added to the decryptor. | 253 // pending buffer again when new key is added to the decryptor. |
| 254 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; | 254 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; |
| 255 | 255 |
| 256 if (need_to_try_again_if_nokey_is_returned) { | 256 if (need_to_try_again_if_nokey_is_returned) { |
| 257 // The |state_| is still kPendingDecode. | 257 // The |state_| is still kPendingDecode. |
| 258 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 259 << ": key was added, resuming decode"; |
| 258 DecodePendingBuffer(); | 260 DecodePendingBuffer(); |
| 259 return; | 261 return; |
| 260 } | 262 } |
| 261 | 263 |
| 262 state_ = kWaitingForKey; | 264 state_ = kWaitingForKey; |
| 263 waiting_for_decryption_key_cb_.Run(); | 265 waiting_for_decryption_key_cb_.Run(); |
| 264 return; | 266 return; |
| 265 } | 267 } |
| 266 | 268 |
| 267 if (status == Decryptor::kNeedMoreData) { | 269 if (status == Decryptor::kNeedMoreData) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 292 void DecryptingVideoDecoder::OnKeyAdded() { | 294 void DecryptingVideoDecoder::OnKeyAdded() { |
| 293 DVLOG(2) << "OnKeyAdded()"; | 295 DVLOG(2) << "OnKeyAdded()"; |
| 294 DCHECK(task_runner_->BelongsToCurrentThread()); | 296 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 295 | 297 |
| 296 if (state_ == kPendingDecode) { | 298 if (state_ == kPendingDecode) { |
| 297 key_added_while_decode_pending_ = true; | 299 key_added_while_decode_pending_ = true; |
| 298 return; | 300 return; |
| 299 } | 301 } |
| 300 | 302 |
| 301 if (state_ == kWaitingForKey) { | 303 if (state_ == kWaitingForKey) { |
| 304 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 305 << ": key added, resuming decode"; |
| 302 state_ = kPendingDecode; | 306 state_ = kPendingDecode; |
| 303 DecodePendingBuffer(); | 307 DecodePendingBuffer(); |
| 304 } | 308 } |
| 305 } | 309 } |
| 306 | 310 |
| 307 void DecryptingVideoDecoder::DoReset() { | 311 void DecryptingVideoDecoder::DoReset() { |
| 308 DCHECK(init_cb_.is_null()); | 312 DCHECK(init_cb_.is_null()); |
| 309 DCHECK(decode_cb_.is_null()); | 313 DCHECK(decode_cb_.is_null()); |
| 310 state_ = kIdle; | 314 state_ = kIdle; |
| 311 base::ResetAndReturn(&reset_cb_).Run(); | 315 base::ResetAndReturn(&reset_cb_).Run(); |
| 312 } | 316 } |
| 313 | 317 |
| 314 } // namespace media | 318 } // namespace media |
| OLD | NEW |