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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 pending_buffer_to_decode_ = buffer; | 280 pending_buffer_to_decode_ = buffer; |
281 state_ = kPendingDecode; | 281 state_ = kPendingDecode; |
282 DecodePendingBuffer(); | 282 DecodePendingBuffer(); |
283 } | 283 } |
284 | 284 |
285 void DecryptingVideoDecoder::DecodePendingBuffer() { | 285 void DecryptingVideoDecoder::DecodePendingBuffer() { |
286 DCHECK(message_loop_->BelongsToCurrentThread()); | 286 DCHECK(message_loop_->BelongsToCurrentThread()); |
287 DCHECK_EQ(state_, kPendingDecode) << state_; | 287 DCHECK_EQ(state_, kPendingDecode) << state_; |
288 TRACE_EVENT_ASYNC_BEGIN0( | 288 TRACE_EVENT_ASYNC_BEGIN0( |
289 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", ++trace_id_); | 289 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", ++trace_id_); |
| 290 |
| 291 int buffer_size = 0; |
| 292 if (!pending_buffer_to_decode_->IsEndOfStream()) { |
| 293 buffer_size = pending_buffer_to_decode_->GetDataSize(); |
| 294 } |
| 295 |
290 decryptor_->DecryptAndDecodeVideo( | 296 decryptor_->DecryptAndDecodeVideo( |
291 pending_buffer_to_decode_, BindToCurrentLoop(base::Bind( | 297 pending_buffer_to_decode_, BindToCurrentLoop(base::Bind( |
292 &DecryptingVideoDecoder::DeliverFrame, this, | 298 &DecryptingVideoDecoder::DeliverFrame, this, buffer_size))); |
293 pending_buffer_to_decode_->GetDataSize()))); | |
294 } | 299 } |
295 | 300 |
296 void DecryptingVideoDecoder::DeliverFrame( | 301 void DecryptingVideoDecoder::DeliverFrame( |
297 int buffer_size, | 302 int buffer_size, |
298 Decryptor::Status status, | 303 Decryptor::Status status, |
299 const scoped_refptr<VideoFrame>& frame) { | 304 const scoped_refptr<VideoFrame>& frame) { |
300 DVLOG(3) << "DeliverFrame() - status: " << status; | 305 DVLOG(3) << "DeliverFrame() - status: " << status; |
301 DCHECK(message_loop_->BelongsToCurrentThread()); | 306 DCHECK(message_loop_->BelongsToCurrentThread()); |
302 TRACE_EVENT_ASYNC_END0( | 307 TRACE_EVENT_ASYNC_END0( |
303 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", trace_id_); | 308 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", trace_id_); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 396 } |
392 | 397 |
393 void DecryptingVideoDecoder::DoReset() { | 398 void DecryptingVideoDecoder::DoReset() { |
394 DCHECK(init_cb_.is_null()); | 399 DCHECK(init_cb_.is_null()); |
395 DCHECK(read_cb_.is_null()); | 400 DCHECK(read_cb_.is_null()); |
396 state_ = kIdle; | 401 state_ = kIdle; |
397 base::ResetAndReturn(&reset_cb_).Run(); | 402 base::ResetAndReturn(&reset_cb_).Run(); |
398 } | 403 } |
399 | 404 |
400 } // namespace media | 405 } // namespace media |
OLD | NEW |