| 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/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns) | 153 int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns) |
| 154 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr), | 154 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr), |
| 155 natural_size(ns) { | 155 natural_size(ns) { |
| 156 } | 156 } |
| 157 | 157 |
| 158 GpuVideoDecoder::BufferData::~BufferData() {} | 158 GpuVideoDecoder::BufferData::~BufferData() {} |
| 159 | 159 |
| 160 GpuVideoDecoder::GpuVideoDecoder( | 160 GpuVideoDecoder::GpuVideoDecoder( |
| 161 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 161 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 162 const scoped_refptr<Factories>& factories) | 162 const scoped_refptr<Factories>& factories) |
| 163 : gvd_loop_proxy_(message_loop), | 163 : demuxer_stream_(NULL), |
| 164 gvd_loop_proxy_(message_loop), |
| 164 weak_factory_(this), | 165 weak_factory_(this), |
| 165 vda_loop_proxy_(factories->GetMessageLoop()), | 166 vda_loop_proxy_(factories->GetMessageLoop()), |
| 166 factories_(factories), | 167 factories_(factories), |
| 167 state_(kNormal), | 168 state_(kNormal), |
| 168 demuxer_read_in_progress_(false), | 169 demuxer_read_in_progress_(false), |
| 169 decoder_texture_target_(0), | 170 decoder_texture_target_(0), |
| 170 next_picture_buffer_id_(0), | 171 next_picture_buffer_id_(0), |
| 171 next_bitstream_buffer_id_(0), | 172 next_bitstream_buffer_id_(0), |
| 172 error_occured_(false), | 173 error_occured_(false), |
| 173 available_pictures_(-1) { | 174 available_pictures_(-1) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 if (vda_.get()) | 211 if (vda_.get()) |
| 211 DestroyVDA(); | 212 DestroyVDA(); |
| 212 if (!pending_read_cb_.is_null()) | 213 if (!pending_read_cb_.is_null()) |
| 213 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); | 214 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
| 214 if (!pending_reset_cb_.is_null()) | 215 if (!pending_reset_cb_.is_null()) |
| 215 base::ResetAndReturn(&pending_reset_cb_).Run(); | 216 base::ResetAndReturn(&pending_reset_cb_).Run(); |
| 216 demuxer_stream_ = NULL; | 217 demuxer_stream_ = NULL; |
| 217 BindToCurrentLoop(closure).Run(); | 218 BindToCurrentLoop(closure).Run(); |
| 218 } | 219 } |
| 219 | 220 |
| 220 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, | 221 void GpuVideoDecoder::Initialize(DemuxerStream* stream, |
| 221 const PipelineStatusCB& orig_status_cb, | 222 const PipelineStatusCB& orig_status_cb, |
| 222 const StatisticsCB& statistics_cb) { | 223 const StatisticsCB& statistics_cb) { |
| 223 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); | 224 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
| 224 weak_this_ = weak_factory_.GetWeakPtr(); | 225 weak_this_ = weak_factory_.GetWeakPtr(); |
| 225 | 226 |
| 226 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( | 227 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( |
| 227 "Media.GpuVideoDecoderInitializeStatus", | 228 "Media.GpuVideoDecoderInitializeStatus", |
| 228 BindToCurrentLoop(orig_status_cb)); | 229 BindToCurrentLoop(orig_status_cb)); |
| 229 DCHECK(!demuxer_stream_); | 230 DCHECK(!demuxer_stream_); |
| 230 | 231 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 | 700 |
| 700 error_occured_ = true; | 701 error_occured_ = true; |
| 701 | 702 |
| 702 if (!pending_read_cb_.is_null()) { | 703 if (!pending_read_cb_.is_null()) { |
| 703 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); | 704 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); |
| 704 return; | 705 return; |
| 705 } | 706 } |
| 706 } | 707 } |
| 707 | 708 |
| 708 } // namespace media | 709 } // namespace media |
| OLD | NEW |