| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 146 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void DecryptingDemuxerStream::DecryptBuffer( | 149 void DecryptingDemuxerStream::DecryptBuffer( |
| 150 DemuxerStream::Status status, | 150 DemuxerStream::Status status, |
| 151 const scoped_refptr<DecoderBuffer>& buffer) { | 151 const scoped_refptr<DecoderBuffer>& buffer) { |
| 152 DVLOG(3) << "DecryptBuffer()"; | 152 DVLOG(3) << "DecryptBuffer()"; |
| 153 DCHECK(message_loop_->BelongsToCurrentThread()); | 153 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 154 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; | 154 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; |
| 155 DCHECK(!read_cb_.is_null()); | 155 DCHECK(!read_cb_.is_null()); |
| 156 DCHECK_EQ(buffer != NULL, status == kOk) << status; | 156 DCHECK_EQ(buffer.get() != NULL, status == kOk) << status; |
| 157 | 157 |
| 158 if (!reset_cb_.is_null()) { | 158 if (!reset_cb_.is_null()) { |
| 159 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); | 159 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| 160 DoReset(); | 160 DoReset(); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 | 163 |
| 164 if (status == kAborted) { | 164 if (status == kAborted) { |
| 165 DVLOG(2) << "DoDecryptBuffer() - kAborted."; | 165 DVLOG(2) << "DoDecryptBuffer() - kAborted."; |
| 166 state_ = kIdle; | 166 state_ = kIdle; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 | 204 |
| 205 void DecryptingDemuxerStream::DeliverBuffer( | 205 void DecryptingDemuxerStream::DeliverBuffer( |
| 206 Decryptor::Status status, | 206 Decryptor::Status status, |
| 207 const scoped_refptr<DecoderBuffer>& decrypted_buffer) { | 207 const scoped_refptr<DecoderBuffer>& decrypted_buffer) { |
| 208 DVLOG(3) << "DeliverBuffer() - status: " << status; | 208 DVLOG(3) << "DeliverBuffer() - status: " << status; |
| 209 DCHECK(message_loop_->BelongsToCurrentThread()); | 209 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 210 DCHECK_EQ(state_, kPendingDecrypt) << state_; | 210 DCHECK_EQ(state_, kPendingDecrypt) << state_; |
| 211 DCHECK_NE(status, Decryptor::kNeedMoreData); | 211 DCHECK_NE(status, Decryptor::kNeedMoreData); |
| 212 DCHECK(!read_cb_.is_null()); | 212 DCHECK(!read_cb_.is_null()); |
| 213 DCHECK(pending_buffer_to_decrypt_); | 213 DCHECK(pending_buffer_to_decrypt_.get()); |
| 214 | 214 |
| 215 bool need_to_try_again_if_nokey = key_added_while_decrypt_pending_; | 215 bool need_to_try_again_if_nokey = key_added_while_decrypt_pending_; |
| 216 key_added_while_decrypt_pending_ = false; | 216 key_added_while_decrypt_pending_ = false; |
| 217 | 217 |
| 218 if (!reset_cb_.is_null()) { | 218 if (!reset_cb_.is_null()) { |
| 219 pending_buffer_to_decrypt_ = NULL; | 219 pending_buffer_to_decrypt_ = NULL; |
| 220 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); | 220 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| 221 DoReset(); | 221 DoReset(); |
| 222 return; | 222 return; |
| 223 } | 223 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 break; | 317 break; |
| 318 } | 318 } |
| 319 | 319 |
| 320 default: | 320 default: |
| 321 NOTREACHED(); | 321 NOTREACHED(); |
| 322 return; | 322 return; |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace media | 326 } // namespace media |
| OLD | NEW |