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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 DemuxerStream::Status status, | 218 DemuxerStream::Status status, |
219 const scoped_refptr<DecoderBuffer>& buffer) { | 219 const scoped_refptr<DecoderBuffer>& buffer) { |
220 DVLOG(3) << "DecryptAndDecodeBuffer()"; | 220 DVLOG(3) << "DecryptAndDecodeBuffer()"; |
221 DCHECK(message_loop_->BelongsToCurrentThread()); | 221 DCHECK(message_loop_->BelongsToCurrentThread()); |
222 | 222 |
223 if (state_ == kStopped) | 223 if (state_ == kStopped) |
224 return; | 224 return; |
225 | 225 |
226 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; | 226 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; |
227 DCHECK(!read_cb_.is_null()); | 227 DCHECK(!read_cb_.is_null()); |
228 DCHECK_EQ(buffer != NULL, status == DemuxerStream::kOk) << status; | 228 DCHECK_EQ(buffer.get() != NULL, status == DemuxerStream::kOk) << status; |
229 | 229 |
230 if (!reset_cb_.is_null()) { | 230 if (!reset_cb_.is_null()) { |
231 base::ResetAndReturn(&read_cb_).Run(kOk, NULL); | 231 base::ResetAndReturn(&read_cb_).Run(kOk, NULL); |
232 DoReset(); | 232 DoReset(); |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 if (status == DemuxerStream::kAborted) { | 236 if (status == DemuxerStream::kAborted) { |
237 DVLOG(2) << "DecryptAndDecodeBuffer() - kAborted"; | 237 DVLOG(2) << "DecryptAndDecodeBuffer() - kAborted"; |
238 state_ = kIdle; | 238 state_ = kIdle; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 DVLOG(3) << "DeliverFrame() - status: " << status; | 270 DVLOG(3) << "DeliverFrame() - status: " << status; |
271 DCHECK(message_loop_->BelongsToCurrentThread()); | 271 DCHECK(message_loop_->BelongsToCurrentThread()); |
272 TRACE_EVENT_ASYNC_END0( | 272 TRACE_EVENT_ASYNC_END0( |
273 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", trace_id_); | 273 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", trace_id_); |
274 | 274 |
275 if (state_ == kStopped) | 275 if (state_ == kStopped) |
276 return; | 276 return; |
277 | 277 |
278 DCHECK_EQ(state_, kPendingDecode) << state_; | 278 DCHECK_EQ(state_, kPendingDecode) << state_; |
279 DCHECK(!read_cb_.is_null()); | 279 DCHECK(!read_cb_.is_null()); |
280 DCHECK(pending_buffer_to_decode_); | 280 DCHECK(pending_buffer_to_decode_.get()); |
281 | 281 |
282 bool need_to_try_again_if_nokey_is_returned = key_added_while_decode_pending_; | 282 bool need_to_try_again_if_nokey_is_returned = key_added_while_decode_pending_; |
283 key_added_while_decode_pending_ = false; | 283 key_added_while_decode_pending_ = false; |
284 | 284 |
285 scoped_refptr<DecoderBuffer> scoped_pending_buffer_to_decode = | 285 scoped_refptr<DecoderBuffer> scoped_pending_buffer_to_decode = |
286 pending_buffer_to_decode_; | 286 pending_buffer_to_decode_; |
287 pending_buffer_to_decode_ = NULL; | 287 pending_buffer_to_decode_ = NULL; |
288 | 288 |
289 if (!reset_cb_.is_null()) { | 289 if (!reset_cb_.is_null()) { |
290 base::ResetAndReturn(&read_cb_).Run(kOk, NULL); | 290 base::ResetAndReturn(&read_cb_).Run(kOk, NULL); |
291 DoReset(); | 291 DoReset(); |
292 return; | 292 return; |
293 } | 293 } |
294 | 294 |
295 DCHECK_EQ(status == Decryptor::kSuccess, frame != NULL); | 295 DCHECK_EQ(status == Decryptor::kSuccess, frame.get() != NULL); |
296 | 296 |
297 if (status == Decryptor::kError) { | 297 if (status == Decryptor::kError) { |
298 DVLOG(2) << "DeliverFrame() - kError"; | 298 DVLOG(2) << "DeliverFrame() - kError"; |
299 state_ = kError; | 299 state_ = kError; |
300 base::ResetAndReturn(&read_cb_).Run(kDecodeError, NULL); | 300 base::ResetAndReturn(&read_cb_).Run(kDecodeError, NULL); |
301 return; | 301 return; |
302 } | 302 } |
303 | 303 |
304 if (status == Decryptor::kNoKey) { | 304 if (status == Decryptor::kNoKey) { |
305 DVLOG(2) << "DeliverFrame() - kNoKey"; | 305 DVLOG(2) << "DeliverFrame() - kNoKey"; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 | 362 |
363 void DecryptingVideoDecoder::DoReset() { | 363 void DecryptingVideoDecoder::DoReset() { |
364 DCHECK(init_cb_.is_null()); | 364 DCHECK(init_cb_.is_null()); |
365 DCHECK(read_cb_.is_null()); | 365 DCHECK(read_cb_.is_null()); |
366 state_ = kIdle; | 366 state_ = kIdle; |
367 base::ResetAndReturn(&reset_cb_).Run(); | 367 base::ResetAndReturn(&reset_cb_).Run(); |
368 } | 368 } |
369 | 369 |
370 } // namespace media | 370 } // namespace media |
OLD | NEW |