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 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id; | 271 DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id; |
272 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key for key ID " | 272 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key for key ID " |
273 << missing_key_id; | 273 << missing_key_id; |
274 | 274 |
275 // 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 |
276 // pending buffer again when new key is added to the decryptor. | 276 // pending buffer again when new key is added to the decryptor. |
277 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; | 277 pending_buffer_to_decode_ = scoped_pending_buffer_to_decode; |
278 | 278 |
279 if (need_to_try_again_if_nokey_is_returned) { | 279 if (need_to_try_again_if_nokey_is_returned) { |
280 // The |state_| is still kPendingDecode. | 280 // The |state_| is still kPendingDecode. |
| 281 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 282 << ": key was added, resuming decode"; |
281 DecodePendingBuffer(); | 283 DecodePendingBuffer(); |
282 return; | 284 return; |
283 } | 285 } |
284 | 286 |
285 state_ = kWaitingForKey; | 287 state_ = kWaitingForKey; |
286 waiting_for_decryption_key_cb_.Run(); | 288 waiting_for_decryption_key_cb_.Run(); |
287 return; | 289 return; |
288 } | 290 } |
289 | 291 |
290 if (status == Decryptor::kNeedMoreData) { | 292 if (status == Decryptor::kNeedMoreData) { |
(...skipping 22 matching lines...) Expand all Loading... |
313 | 315 |
314 void DecryptingAudioDecoder::OnKeyAdded() { | 316 void DecryptingAudioDecoder::OnKeyAdded() { |
315 DCHECK(task_runner_->BelongsToCurrentThread()); | 317 DCHECK(task_runner_->BelongsToCurrentThread()); |
316 | 318 |
317 if (state_ == kPendingDecode) { | 319 if (state_ == kPendingDecode) { |
318 key_added_while_decode_pending_ = true; | 320 key_added_while_decode_pending_ = true; |
319 return; | 321 return; |
320 } | 322 } |
321 | 323 |
322 if (state_ == kWaitingForKey) { | 324 if (state_ == kWaitingForKey) { |
| 325 MEDIA_LOG(INFO, media_log_) << GetDisplayName() |
| 326 << ": key added, resuming decode"; |
323 state_ = kPendingDecode; | 327 state_ = kPendingDecode; |
324 DecodePendingBuffer(); | 328 DecodePendingBuffer(); |
325 } | 329 } |
326 } | 330 } |
327 | 331 |
328 void DecryptingAudioDecoder::DoReset() { | 332 void DecryptingAudioDecoder::DoReset() { |
329 DCHECK(init_cb_.is_null()); | 333 DCHECK(init_cb_.is_null()); |
330 DCHECK(decode_cb_.is_null()); | 334 DCHECK(decode_cb_.is_null()); |
331 timestamp_helper_->SetBaseTimestamp(kNoTimestamp); | 335 timestamp_helper_->SetBaseTimestamp(kNoTimestamp); |
332 state_ = kIdle; | 336 state_ = kIdle; |
(...skipping 19 matching lines...) Expand all Loading... |
352 } | 356 } |
353 | 357 |
354 frame->set_timestamp(current_time); | 358 frame->set_timestamp(current_time); |
355 timestamp_helper_->AddFrames(frame->frame_count()); | 359 timestamp_helper_->AddFrames(frame->frame_count()); |
356 | 360 |
357 output_cb_.Run(frame); | 361 output_cb_.Run(frame); |
358 } | 362 } |
359 } | 363 } |
360 | 364 |
361 } // namespace media | 365 } // namespace media |
OLD | NEW |