| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 void DecryptingVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, | 82 void DecryptingVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 83 const DecodeCB& decode_cb) { | 83 const DecodeCB& decode_cb) { |
| 84 DVLOG(3) << "Decode()"; | 84 DVLOG(3) << "Decode()"; |
| 85 DCHECK(task_runner_->BelongsToCurrentThread()); | 85 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 86 DCHECK(state_ == kIdle || | 86 DCHECK(state_ == kIdle || |
| 87 state_ == kDecodeFinished || | 87 state_ == kDecodeFinished || |
| 88 state_ == kError) << state_; | 88 state_ == kError) << state_; |
| 89 DCHECK(!decode_cb.is_null()); | 89 DCHECK(!decode_cb.is_null()); |
| 90 CHECK(decode_cb_.is_null()) << "Overlapping decodes are not supported."; | 90 // Overlapping decodes are not supported. |
| 91 CHECK(decode_cb_.is_null()); |
| 91 | 92 |
| 92 decode_cb_ = BindToCurrentLoop(decode_cb); | 93 decode_cb_ = BindToCurrentLoop(decode_cb); |
| 93 | 94 |
| 94 if (state_ == kError) { | 95 if (state_ == kError) { |
| 95 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); | 96 base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR); |
| 96 return; | 97 return; |
| 97 } | 98 } |
| 98 | 99 |
| 99 // Return empty frames if decoding has finished. | 100 // Return empty frames if decoding has finished. |
| 100 if (state_ == kDecodeFinished) { | 101 if (state_ == kDecodeFinished) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 310 } |
| 310 | 311 |
| 311 void DecryptingVideoDecoder::DoReset() { | 312 void DecryptingVideoDecoder::DoReset() { |
| 312 DCHECK(init_cb_.is_null()); | 313 DCHECK(init_cb_.is_null()); |
| 313 DCHECK(decode_cb_.is_null()); | 314 DCHECK(decode_cb_.is_null()); |
| 314 state_ = kIdle; | 315 state_ = kIdle; |
| 315 base::ResetAndReturn(&reset_cb_).Run(); | 316 base::ResetAndReturn(&reset_cb_).Run(); |
| 316 } | 317 } |
| 317 | 318 |
| 318 } // namespace media | 319 } // namespace media |
| OLD | NEW |