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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 DCHECK(!closure.is_null()); | 80 DCHECK(!closure.is_null()); |
81 | 81 |
82 // VideoRendererBase::Flush() can't complete while it has a pending read to | 82 // VideoRendererBase::Flush() can't complete while it has a pending read to |
83 // us, so we fulfill such a read here. | 83 // us, so we fulfill such a read here. |
84 if (!pending_read_cb_.is_null()) | 84 if (!pending_read_cb_.is_null()) |
85 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); | 85 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
86 | 86 |
87 if (shutting_down_) { | 87 if (shutting_down_) { |
88 // Immediately fire the callback instead of waiting for the reset to | 88 // Immediately fire the callback instead of waiting for the reset to |
89 // complete (which will happen after PipelineImpl::Stop() completes). | 89 // complete (which will happen after PipelineImpl::Stop() completes). |
90 closure.Run(); | 90 gvd_loop_proxy_->PostTask(FROM_HERE, closure); |
91 } else { | 91 } else { |
92 pending_reset_cb_ = closure; | 92 pending_reset_cb_ = closure; |
93 } | 93 } |
94 | 94 |
95 vda_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 95 vda_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
96 &VideoDecodeAccelerator::Reset, vda_)); | 96 &VideoDecodeAccelerator::Reset, vda_)); |
97 } | 97 } |
98 | 98 |
99 void GpuVideoDecoder::Stop(const base::Closure& closure) { | 99 void GpuVideoDecoder::Stop(const base::Closure& closure) { |
100 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { | 100 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 error_occured_ = true; | 536 error_occured_ = true; |
537 | 537 |
538 if (!pending_read_cb_.is_null()) { | 538 if (!pending_read_cb_.is_null()) { |
539 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); | 539 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); |
540 return; | 540 return; |
541 } | 541 } |
542 } | 542 } |
543 | 543 |
544 } // namespace media | 544 } // namespace media |
OLD | NEW |