| 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/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "media/base/bind_to_loop.h" | 13 #include "media/base/bind_to_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/demuxer_stream.h" | 16 #include "media/base/demuxer_stream.h" |
| 17 #include "media/base/pipeline.h" | 17 #include "media/base/pipeline.h" |
| 18 #include "media/base/video_decoder_config.h" | 18 #include "media/base/video_decoder_config.h" |
| 19 #include "media/base/video_frame.h" | 19 #include "media/base/video_frame.h" |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 | 22 |
| 23 DecryptingVideoDecoder::DecryptingVideoDecoder( | 23 DecryptingVideoDecoder::DecryptingVideoDecoder( |
| 24 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 24 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 25 const SetDecryptorReadyCB& set_decryptor_ready_cb) | 25 const SetDecryptorReadyCB& set_decryptor_ready_cb) |
| 26 : message_loop_(message_loop), | 26 : message_loop_(message_loop), |
| 27 weak_factory_(this), | 27 weak_factory_(this), |
| 28 state_(kUninitialized), | 28 state_(kUninitialized), |
| 29 demuxer_stream_(NULL), |
| 29 set_decryptor_ready_cb_(set_decryptor_ready_cb), | 30 set_decryptor_ready_cb_(set_decryptor_ready_cb), |
| 30 decryptor_(NULL), | 31 decryptor_(NULL), |
| 31 key_added_while_decode_pending_(false), | 32 key_added_while_decode_pending_(false), |
| 32 trace_id_(0) { | 33 trace_id_(0) { |
| 33 } | 34 } |
| 34 | 35 |
| 35 void DecryptingVideoDecoder::Initialize( | 36 void DecryptingVideoDecoder::Initialize( |
| 36 const scoped_refptr<DemuxerStream>& stream, | 37 DemuxerStream* stream, |
| 37 const PipelineStatusCB& status_cb, | 38 const PipelineStatusCB& status_cb, |
| 38 const StatisticsCB& statistics_cb) { | 39 const StatisticsCB& statistics_cb) { |
| 39 DVLOG(2) << "Initialize()"; | 40 DVLOG(2) << "Initialize()"; |
| 40 DCHECK(message_loop_->BelongsToCurrentThread()); | 41 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 41 DCHECK_EQ(state_, kUninitialized) << state_; | 42 DCHECK_EQ(state_, kUninitialized) << state_; |
| 42 DCHECK(stream); | 43 DCHECK(stream); |
| 43 init_cb_ = BindToCurrentLoop(status_cb); | 44 init_cb_ = BindToCurrentLoop(status_cb); |
| 44 weak_this_ = weak_factory_.GetWeakPtr(); | 45 weak_this_ = weak_factory_.GetWeakPtr(); |
| 45 | 46 |
| 46 const VideoDecoderConfig& config = stream->video_decoder_config(); | 47 const VideoDecoderConfig& config = stream->video_decoder_config(); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 401 } |
| 401 | 402 |
| 402 void DecryptingVideoDecoder::DoReset() { | 403 void DecryptingVideoDecoder::DoReset() { |
| 403 DCHECK(init_cb_.is_null()); | 404 DCHECK(init_cb_.is_null()); |
| 404 DCHECK(read_cb_.is_null()); | 405 DCHECK(read_cb_.is_null()); |
| 405 state_ = kIdle; | 406 state_ = kIdle; |
| 406 base::ResetAndReturn(&reset_cb_).Run(); | 407 base::ResetAndReturn(&reset_cb_).Run(); |
| 407 } | 408 } |
| 408 | 409 |
| 409 } // namespace media | 410 } // namespace media |
| OLD | NEW |