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/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 next_picture_buffer_id_(0), | 65 next_picture_buffer_id_(0), |
66 next_bitstream_buffer_id_(0), | 66 next_bitstream_buffer_id_(0), |
67 available_pictures_(0) { | 67 available_pictures_(0) { |
68 DCHECK(factories_.get()); | 68 DCHECK(factories_.get()); |
69 } | 69 } |
70 | 70 |
71 void GpuVideoDecoder::Reset(const base::Closure& closure) { | 71 void GpuVideoDecoder::Reset(const base::Closure& closure) { |
72 DVLOG(3) << "Reset()"; | 72 DVLOG(3) << "Reset()"; |
73 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); | 73 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
74 | 74 |
75 if (state_ == kDrainingDecoder && !factories_->IsAborted()) { | 75 if (state_ == kDrainingDecoder) { |
76 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 76 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
77 &GpuVideoDecoder::Reset, weak_this_, closure)); | 77 &GpuVideoDecoder::Reset, weak_this_, closure)); |
78 // NOTE: if we're deferring Reset() until a Flush() completes, return | 78 // NOTE: if we're deferring Reset() until a Flush() completes, return |
79 // queued pictures to the VDA so they can be used to finish that Flush(). | 79 // queued pictures to the VDA so they can be used to finish that Flush(). |
80 if (pending_decode_cb_.is_null()) | 80 if (pending_decode_cb_.is_null()) |
81 ready_video_frames_.clear(); | 81 ready_video_frames_.clear(); |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 // Throw away any already-decoded, not-yet-delivered frames. | 85 // Throw away any already-decoded, not-yet-delivered frames. |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 603 |
604 state_ = kError; | 604 state_ = kError; |
605 | 605 |
606 if (!pending_decode_cb_.is_null()) { | 606 if (!pending_decode_cb_.is_null()) { |
607 base::ResetAndReturn(&pending_decode_cb_).Run(kDecodeError, NULL); | 607 base::ResetAndReturn(&pending_decode_cb_).Run(kDecodeError, NULL); |
608 return; | 608 return; |
609 } | 609 } |
610 } | 610 } |
611 | 611 |
612 } // namespace media | 612 } // namespace media |
OLD | NEW |