| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 InitializeDecoder(); | 96 InitializeDecoder(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void DecryptingAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, | 99 void DecryptingAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 100 const DecodeCB& decode_cb) { | 100 const DecodeCB& decode_cb) { |
| 101 DVLOG(3) << "Decode()"; | 101 DVLOG(3) << "Decode()"; |
| 102 DCHECK(task_runner_->BelongsToCurrentThread()); | 102 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 103 DCHECK(state_ == kIdle || state_ == kDecodeFinished) << state_; | 103 DCHECK(state_ == kIdle || state_ == kDecodeFinished) << state_; |
| 104 DCHECK(!decode_cb.is_null()); | 104 DCHECK(!decode_cb.is_null()); |
| 105 CHECK(decode_cb_.is_null()) << "Overlapping decodes are not supported."; | 105 // Overlapping decodes are not supported. |
| 106 CHECK(decode_cb_.is_null()); |
| 106 | 107 |
| 107 decode_cb_ = BindToCurrentLoop(decode_cb); | 108 decode_cb_ = BindToCurrentLoop(decode_cb); |
| 108 | 109 |
| 109 // Return empty (end-of-stream) frames if decoding has finished. | 110 // Return empty (end-of-stream) frames if decoding has finished. |
| 110 if (state_ == kDecodeFinished) { | 111 if (state_ == kDecodeFinished) { |
| 111 output_cb_.Run(AudioBuffer::CreateEOSBuffer()); | 112 output_cb_.Run(AudioBuffer::CreateEOSBuffer()); |
| 112 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::OK); | 113 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::OK); |
| 113 return; | 114 return; |
| 114 } | 115 } |
| 115 | 116 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 357 } |
| 357 | 358 |
| 358 frame->set_timestamp(current_time); | 359 frame->set_timestamp(current_time); |
| 359 timestamp_helper_->AddFrames(frame->frame_count()); | 360 timestamp_helper_->AddFrames(frame->frame_count()); |
| 360 | 361 |
| 361 output_cb_.Run(frame); | 362 output_cb_.Run(frame); |
| 362 } | 363 } |
| 363 } | 364 } |
| 364 | 365 |
| 365 } // namespace media | 366 } // namespace media |
| OLD | NEW |