| 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 const char DecryptingVideoDecoder::kDecoderName[] = "DecryptingVideoDecoder"; |
| 23 |
| 22 DecryptingVideoDecoder::DecryptingVideoDecoder( | 24 DecryptingVideoDecoder::DecryptingVideoDecoder( |
| 23 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 25 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 24 const SetDecryptorReadyCB& set_decryptor_ready_cb) | 26 const SetDecryptorReadyCB& set_decryptor_ready_cb) |
| 25 : task_runner_(task_runner), | 27 : task_runner_(task_runner), |
| 26 state_(kUninitialized), | 28 state_(kUninitialized), |
| 27 set_decryptor_ready_cb_(set_decryptor_ready_cb), | 29 set_decryptor_ready_cb_(set_decryptor_ready_cb), |
| 28 decryptor_(NULL), | 30 decryptor_(NULL), |
| 29 key_added_while_decode_pending_(false), | 31 key_added_while_decode_pending_(false), |
| 30 trace_id_(0), | 32 trace_id_(0), |
| 31 weak_factory_(this) {} | 33 weak_factory_(this) {} |
| 32 | 34 |
| 33 std::string DecryptingVideoDecoder::GetDisplayName() const { | 35 std::string DecryptingVideoDecoder::GetDisplayName() const { |
| 34 return "DecryptingVideoDecoder"; | 36 return kDecoderName; |
| 35 } | 37 } |
| 36 | 38 |
| 37 void DecryptingVideoDecoder::Initialize(const VideoDecoderConfig& config, | 39 void DecryptingVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| 38 bool /* low_delay */, | 40 bool /* low_delay */, |
| 39 const PipelineStatusCB& status_cb, | 41 const PipelineStatusCB& status_cb, |
| 40 const OutputCB& output_cb) { | 42 const OutputCB& output_cb) { |
| 41 DVLOG(2) << "Initialize()"; | 43 DVLOG(2) << "Initialize()"; |
| 42 DCHECK(task_runner_->BelongsToCurrentThread()); | 44 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 43 DCHECK(state_ == kUninitialized || | 45 DCHECK(state_ == kUninitialized || |
| 44 state_ == kIdle || | 46 state_ == kIdle || |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 314 } |
| 313 | 315 |
| 314 void DecryptingVideoDecoder::DoReset() { | 316 void DecryptingVideoDecoder::DoReset() { |
| 315 DCHECK(init_cb_.is_null()); | 317 DCHECK(init_cb_.is_null()); |
| 316 DCHECK(decode_cb_.is_null()); | 318 DCHECK(decode_cb_.is_null()); |
| 317 state_ = kIdle; | 319 state_ = kIdle; |
| 318 base::ResetAndReturn(&reset_cb_).Run(); | 320 base::ResetAndReturn(&reset_cb_).Run(); |
| 319 } | 321 } |
| 320 | 322 |
| 321 } // namespace media | 323 } // namespace media |
| OLD | NEW |