| 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" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 DCHECK(message_loop_->BelongsToCurrentThread()); | 164 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 165 | 165 |
| 166 if (state_ == kStopped) | 166 if (state_ == kStopped) |
| 167 return; | 167 return; |
| 168 | 168 |
| 169 DCHECK_EQ(state_, kDecryptorRequested) << state_; | 169 DCHECK_EQ(state_, kDecryptorRequested) << state_; |
| 170 DCHECK(!init_cb_.is_null()); | 170 DCHECK(!init_cb_.is_null()); |
| 171 DCHECK(!set_decryptor_ready_cb_.is_null()); | 171 DCHECK(!set_decryptor_ready_cb_.is_null()); |
| 172 set_decryptor_ready_cb_.Reset(); | 172 set_decryptor_ready_cb_.Reset(); |
| 173 | 173 |
| 174 if (!decryptor) { |
| 175 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
| 176 state_ = kStopped; |
| 177 return; |
| 178 } |
| 179 |
| 174 decryptor_ = decryptor; | 180 decryptor_ = decryptor; |
| 175 | 181 |
| 176 state_ = kPendingDecoderInit; | 182 state_ = kPendingDecoderInit; |
| 177 decryptor_->InitializeVideoDecoder( | 183 decryptor_->InitializeVideoDecoder( |
| 178 demuxer_stream_->video_decoder_config(), BindToCurrentLoop(base::Bind( | 184 demuxer_stream_->video_decoder_config(), BindToCurrentLoop(base::Bind( |
| 179 &DecryptingVideoDecoder::FinishInitialization, weak_this_))); | 185 &DecryptingVideoDecoder::FinishInitialization, weak_this_))); |
| 180 } | 186 } |
| 181 | 187 |
| 182 void DecryptingVideoDecoder::FinishInitialization(bool success) { | 188 void DecryptingVideoDecoder::FinishInitialization(bool success) { |
| 183 DVLOG(2) << "FinishInitialization()"; | 189 DVLOG(2) << "FinishInitialization()"; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 } | 367 } |
| 362 | 368 |
| 363 void DecryptingVideoDecoder::DoReset() { | 369 void DecryptingVideoDecoder::DoReset() { |
| 364 DCHECK(init_cb_.is_null()); | 370 DCHECK(init_cb_.is_null()); |
| 365 DCHECK(read_cb_.is_null()); | 371 DCHECK(read_cb_.is_null()); |
| 366 state_ = kIdle; | 372 state_ = kIdle; |
| 367 base::ResetAndReturn(&reset_cb_).Run(); | 373 base::ResetAndReturn(&reset_cb_).Run(); |
| 368 } | 374 } |
| 369 | 375 |
| 370 } // namespace media | 376 } // namespace media |
| OLD | NEW |