| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 decode_cb_ = BindToCurrentLoop(decode_cb); | 76 decode_cb_ = BindToCurrentLoop(decode_cb); |
| 77 | 77 |
| 78 if (state_ == kError) { | 78 if (state_ == kError) { |
| 79 base::ResetAndReturn(&decode_cb_).Run(kDecodeError); | 79 base::ResetAndReturn(&decode_cb_).Run(kDecodeError); |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Return empty frames if decoding has finished. | 83 // Return empty frames if decoding has finished. |
| 84 if (state_ == kDecodeFinished) { | 84 if (state_ == kDecodeFinished) { |
| 85 output_cb_.Run(VideoFrame::CreateEOSFrame()); | |
| 86 base::ResetAndReturn(&decode_cb_).Run(kOk); | 85 base::ResetAndReturn(&decode_cb_).Run(kOk); |
| 87 return; | 86 return; |
| 88 } | 87 } |
| 89 | 88 |
| 90 pending_buffer_to_decode_ = buffer; | 89 pending_buffer_to_decode_ = buffer; |
| 91 state_ = kPendingDecode; | 90 state_ = kPendingDecode; |
| 92 DecodePendingBuffer(); | 91 DecodePendingBuffer(); |
| 93 } | 92 } |
| 94 | 93 |
| 95 void DecryptingVideoDecoder::Reset(const base::Closure& closure) { | 94 void DecryptingVideoDecoder::Reset(const base::Closure& closure) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 270 } |
| 272 | 271 |
| 273 state_ = kWaitingForKey; | 272 state_ = kWaitingForKey; |
| 274 return; | 273 return; |
| 275 } | 274 } |
| 276 | 275 |
| 277 if (status == Decryptor::kNeedMoreData) { | 276 if (status == Decryptor::kNeedMoreData) { |
| 278 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; | 277 DVLOG(2) << "DeliverFrame() - kNeedMoreData"; |
| 279 if (scoped_pending_buffer_to_decode->end_of_stream()) { | 278 if (scoped_pending_buffer_to_decode->end_of_stream()) { |
| 280 state_ = kDecodeFinished; | 279 state_ = kDecodeFinished; |
| 281 output_cb_.Run(media::VideoFrame::CreateEOSFrame()); | |
| 282 } else { | 280 } else { |
| 283 state_ = kIdle; | 281 state_ = kIdle; |
| 284 } | 282 } |
| 285 base::ResetAndReturn(&decode_cb_).Run(kOk); | 283 base::ResetAndReturn(&decode_cb_).Run(kOk); |
| 286 return; | 284 return; |
| 287 } | 285 } |
| 288 | 286 |
| 289 DCHECK_EQ(status, Decryptor::kSuccess); | 287 DCHECK_EQ(status, Decryptor::kSuccess); |
| 290 // No frame returned with kSuccess should be end-of-stream frame. | 288 // No frame returned with kSuccess should be end-of-stream frame. |
| 291 DCHECK(!frame->end_of_stream()); | 289 DCHECK(!frame->end_of_stream()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 310 } | 308 } |
| 311 | 309 |
| 312 void DecryptingVideoDecoder::DoReset() { | 310 void DecryptingVideoDecoder::DoReset() { |
| 313 DCHECK(init_cb_.is_null()); | 311 DCHECK(init_cb_.is_null()); |
| 314 DCHECK(decode_cb_.is_null()); | 312 DCHECK(decode_cb_.is_null()); |
| 315 state_ = kIdle; | 313 state_ = kIdle; |
| 316 base::ResetAndReturn(&reset_cb_).Run(); | 314 base::ResetAndReturn(&reset_cb_).Run(); |
| 317 } | 315 } |
| 318 | 316 |
| 319 } // namespace media | 317 } // namespace media |
| OLD | NEW |