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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "media/base/demuxer_stream.h" | 10 #include "media/base/demuxer_stream.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 217 } |
218 | 218 |
219 void GpuVideoDecoder::RequestBufferDecode(const scoped_refptr<Buffer>& buffer) { | 219 void GpuVideoDecoder::RequestBufferDecode(const scoped_refptr<Buffer>& buffer) { |
220 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { | 220 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { |
221 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 221 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
222 &GpuVideoDecoder::RequestBufferDecode, this, buffer)); | 222 &GpuVideoDecoder::RequestBufferDecode, this, buffer)); |
223 return; | 223 return; |
224 } | 224 } |
225 demuxer_read_in_progress_ = false; | 225 demuxer_read_in_progress_ = false; |
226 | 226 |
| 227 if (!buffer) { |
| 228 if (pending_read_cb_.is_null()) |
| 229 return; |
| 230 |
| 231 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 232 pending_read_cb_, scoped_refptr<VideoFrame>())); |
| 233 pending_read_cb_.Reset(); |
| 234 return; |
| 235 } |
| 236 |
227 if (!vda_) { | 237 if (!vda_) { |
228 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); | 238 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
229 return; | 239 return; |
230 } | 240 } |
231 | 241 |
232 if (buffer->IsEndOfStream()) { | 242 if (buffer->IsEndOfStream()) { |
233 if (state_ == kNormal) { | 243 if (state_ == kNormal) { |
234 state_ = kDrainingDecoder; | 244 state_ = kDrainingDecoder; |
235 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 245 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
236 &VideoDecodeAccelerator::Flush, vda_)); | 246 &VideoDecodeAccelerator::Flush, vda_)); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 &GpuVideoDecoder::NotifyError, this, error)); | 526 &GpuVideoDecoder::NotifyError, this, error)); |
517 return; | 527 return; |
518 } | 528 } |
519 vda_ = NULL; | 529 vda_ = NULL; |
520 DLOG(ERROR) << "VDA Error: " << error; | 530 DLOG(ERROR) << "VDA Error: " << error; |
521 if (host()) | 531 if (host()) |
522 host()->SetError(PIPELINE_ERROR_DECODE); | 532 host()->SetError(PIPELINE_ERROR_DECODE); |
523 } | 533 } |
524 | 534 |
525 } // namespace media | 535 } // namespace media |
OLD | NEW |