| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "media/base/bind_to_current_loop.h" | 13 #include "media/base/bind_to_current_loop.h" |
| 14 #include "media/base/decoder_buffer.h" | 14 #include "media/base/decoder_buffer.h" |
| 15 #include "media/base/decryptor.h" | 15 #include "media/base/decryptor.h" |
| 16 #include "media/base/pipeline.h" | 16 #include "media/base/pipeline.h" |
| 17 #include "media/base/video_decoder_config.h" | 17 #include "media/base/video_decoder_config.h" |
| 18 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 DecryptingVideoDecoder::DecryptingVideoDecoder( | 22 DecryptingVideoDecoder::DecryptingVideoDecoder( |
| 23 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 23 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 24 const SetDecryptorReadyCB& set_decryptor_ready_cb) | 24 const SetDecryptorReadyCB& set_decryptor_ready_cb) |
| 25 : task_runner_(task_runner), | 25 : task_runner_(task_runner), |
| 26 weak_factory_(this), | |
| 27 state_(kUninitialized), | 26 state_(kUninitialized), |
| 28 set_decryptor_ready_cb_(set_decryptor_ready_cb), | 27 set_decryptor_ready_cb_(set_decryptor_ready_cb), |
| 29 decryptor_(NULL), | 28 decryptor_(NULL), |
| 30 key_added_while_decode_pending_(false), | 29 key_added_while_decode_pending_(false), |
| 31 trace_id_(0) { | 30 trace_id_(0), |
| 32 } | 31 weak_factory_(this) {} |
| 33 | 32 |
| 34 void DecryptingVideoDecoder::Initialize(const VideoDecoderConfig& config, | 33 void DecryptingVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| 35 const PipelineStatusCB& status_cb) { | 34 const PipelineStatusCB& status_cb) { |
| 36 DVLOG(2) << "Initialize()"; | 35 DVLOG(2) << "Initialize()"; |
| 37 DCHECK(task_runner_->BelongsToCurrentThread()); | 36 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 38 DCHECK(state_ == kUninitialized || | 37 DCHECK(state_ == kUninitialized || |
| 39 state_ == kIdle || | 38 state_ == kIdle || |
| 40 state_ == kDecodeFinished) << state_; | 39 state_ == kDecodeFinished) << state_; |
| 41 DCHECK(decode_cb_.is_null()); | 40 DCHECK(decode_cb_.is_null()); |
| 42 DCHECK(reset_cb_.is_null()); | 41 DCHECK(reset_cb_.is_null()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 308 } |
| 310 | 309 |
| 311 void DecryptingVideoDecoder::DoReset() { | 310 void DecryptingVideoDecoder::DoReset() { |
| 312 DCHECK(init_cb_.is_null()); | 311 DCHECK(init_cb_.is_null()); |
| 313 DCHECK(decode_cb_.is_null()); | 312 DCHECK(decode_cb_.is_null()); |
| 314 state_ = kIdle; | 313 state_ = kIdle; |
| 315 base::ResetAndReturn(&reset_cb_).Run(); | 314 base::ResetAndReturn(&reset_cb_).Run(); |
| 316 } | 315 } |
| 317 | 316 |
| 318 } // namespace media | 317 } // namespace media |
| OLD | NEW |