| 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_demuxer_stream.h" | 5 #include "media/filters/decrypting_demuxer_stream.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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 DecryptingDemuxerStream::~DecryptingDemuxerStream() {} | 129 DecryptingDemuxerStream::~DecryptingDemuxerStream() {} |
| 130 | 130 |
| 131 void DecryptingDemuxerStream::SetDecryptor(Decryptor* decryptor) { | 131 void DecryptingDemuxerStream::SetDecryptor(Decryptor* decryptor) { |
| 132 DVLOG(2) << "SetDecryptor()"; | 132 DVLOG(2) << "SetDecryptor()"; |
| 133 DCHECK(message_loop_->BelongsToCurrentThread()); | 133 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 134 DCHECK_EQ(state_, kDecryptorRequested) << state_; | 134 DCHECK_EQ(state_, kDecryptorRequested) << state_; |
| 135 DCHECK(!init_cb_.is_null()); | 135 DCHECK(!init_cb_.is_null()); |
| 136 DCHECK(!set_decryptor_ready_cb_.is_null()); | 136 DCHECK(!set_decryptor_ready_cb_.is_null()); |
| 137 | 137 |
| 138 set_decryptor_ready_cb_.Reset(); | 138 set_decryptor_ready_cb_.Reset(); |
| 139 |
| 140 if (!decryptor) { |
| 141 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
| 142 state_ = kUninitialized; |
| 143 return; |
| 144 } |
| 145 |
| 139 decryptor_ = decryptor; | 146 decryptor_ = decryptor; |
| 140 | 147 |
| 141 decryptor_->RegisterNewKeyCB( | 148 decryptor_->RegisterNewKeyCB( |
| 142 GetDecryptorStreamType(), | 149 GetDecryptorStreamType(), |
| 143 BIND_TO_LOOP(&DecryptingDemuxerStream::OnKeyAdded)); | 150 BIND_TO_LOOP(&DecryptingDemuxerStream::OnKeyAdded)); |
| 144 | 151 |
| 145 state_ = kIdle; | 152 state_ = kIdle; |
| 146 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 153 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
| 147 } | 154 } |
| 148 | 155 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 break; | 322 break; |
| 316 } | 323 } |
| 317 | 324 |
| 318 default: | 325 default: |
| 319 NOTREACHED(); | 326 NOTREACHED(); |
| 320 return; | 327 return; |
| 321 } | 328 } |
| 322 } | 329 } |
| 323 | 330 |
| 324 } // namespace media | 331 } // namespace media |
| OLD | NEW |