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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 DecodePendingBuffer(); | 253 DecodePendingBuffer(); |
254 } | 254 } |
255 | 255 |
256 void DecryptingVideoDecoder::DecodePendingBuffer() { | 256 void DecryptingVideoDecoder::DecodePendingBuffer() { |
257 DCHECK(message_loop_->BelongsToCurrentThread()); | 257 DCHECK(message_loop_->BelongsToCurrentThread()); |
258 DCHECK_EQ(state_, kPendingDecode) << state_; | 258 DCHECK_EQ(state_, kPendingDecode) << state_; |
259 TRACE_EVENT_ASYNC_BEGIN0( | 259 TRACE_EVENT_ASYNC_BEGIN0( |
260 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", ++trace_id_); | 260 "eme", "DecryptingVideoDecoder::DecodePendingBuffer", ++trace_id_); |
261 | 261 |
262 int buffer_size = 0; | 262 int buffer_size = 0; |
263 if (!pending_buffer_to_decode_->IsEndOfStream()) { | 263 if (!pending_buffer_to_decode_->is_end_of_stream()) { |
264 buffer_size = pending_buffer_to_decode_->GetDataSize(); | 264 buffer_size = pending_buffer_to_decode_->get_data_size(); |
265 } | 265 } |
266 | 266 |
267 decryptor_->DecryptAndDecodeVideo( | 267 decryptor_->DecryptAndDecodeVideo( |
268 pending_buffer_to_decode_, BindToCurrentLoop(base::Bind( | 268 pending_buffer_to_decode_, BindToCurrentLoop(base::Bind( |
269 &DecryptingVideoDecoder::DeliverFrame, weak_this_, buffer_size))); | 269 &DecryptingVideoDecoder::DeliverFrame, weak_this_, buffer_size))); |
270 } | 270 } |
271 | 271 |
272 void DecryptingVideoDecoder::DeliverFrame( | 272 void DecryptingVideoDecoder::DeliverFrame( |
273 int buffer_size, | 273 int buffer_size, |
274 Decryptor::Status status, | 274 Decryptor::Status status, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 // The buffer has been accepted by the decoder, let's report statistics. | 326 // The buffer has been accepted by the decoder, let's report statistics. |
327 if (buffer_size) { | 327 if (buffer_size) { |
328 PipelineStatistics statistics; | 328 PipelineStatistics statistics; |
329 statistics.video_bytes_decoded = buffer_size; | 329 statistics.video_bytes_decoded = buffer_size; |
330 statistics_cb_.Run(statistics); | 330 statistics_cb_.Run(statistics); |
331 } | 331 } |
332 | 332 |
333 if (status == Decryptor::kNeedMoreData) { | 333 if (status == Decryptor::kNeedMoreData) { |
334 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; | 334 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; |
335 if (scoped_pending_buffer_to_decode->IsEndOfStream()) { | 335 if (scoped_pending_buffer_to_decode->is_end_of_stream()) { |
336 state_ = kDecodeFinished; | 336 state_ = kDecodeFinished; |
337 base::ResetAndReturn(&read_cb_).Run( | 337 base::ResetAndReturn(&read_cb_).Run( |
338 kOk, media::VideoFrame::CreateEmptyFrame()); | 338 kOk, media::VideoFrame::CreateEmptyFrame()); |
339 return; | 339 return; |
340 } | 340 } |
341 | 341 |
342 state_ = kPendingDemuxerRead; | 342 state_ = kPendingDemuxerRead; |
343 ReadFromDemuxerStream(); | 343 ReadFromDemuxerStream(); |
344 return; | 344 return; |
345 } | 345 } |
(...skipping 21 matching lines...) Expand all Loading... |
367 } | 367 } |
368 | 368 |
369 void DecryptingVideoDecoder::DoReset() { | 369 void DecryptingVideoDecoder::DoReset() { |
370 DCHECK(init_cb_.is_null()); | 370 DCHECK(init_cb_.is_null()); |
371 DCHECK(read_cb_.is_null()); | 371 DCHECK(read_cb_.is_null()); |
372 state_ = kIdle; | 372 state_ = kIdle; |
373 base::ResetAndReturn(&reset_cb_).Run(); | 373 base::ResetAndReturn(&reset_cb_).Run(); |
374 } | 374 } |
375 | 375 |
376 } // namespace media | 376 } // namespace media |
OLD | NEW |