| 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 available_pictures_(-1) { | 173 available_pictures_(-1) { |
| 173 DCHECK(factories_); | 174 DCHECK(factories_); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (vda_) | 210 if (vda_) |
| 210 DestroyVDA(); | 211 DestroyVDA(); |
| 211 if (!pending_read_cb_.is_null()) | 212 if (!pending_read_cb_.is_null()) |
| 212 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); | 213 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
| 213 if (!pending_reset_cb_.is_null()) | 214 if (!pending_reset_cb_.is_null()) |
| 214 base::ResetAndReturn(&pending_reset_cb_).Run(); | 215 base::ResetAndReturn(&pending_reset_cb_).Run(); |
| 215 demuxer_stream_ = NULL; | 216 demuxer_stream_ = NULL; |
| 216 BindToCurrentLoop(closure).Run(); | 217 BindToCurrentLoop(closure).Run(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, | 220 void GpuVideoDecoder::Initialize(DemuxerStream* stream, |
| 220 const PipelineStatusCB& orig_status_cb, | 221 const PipelineStatusCB& orig_status_cb, |
| 221 const StatisticsCB& statistics_cb) { | 222 const StatisticsCB& statistics_cb) { |
| 222 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); | 223 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
| 223 weak_this_ = weak_factory_.GetWeakPtr(); | 224 weak_this_ = weak_factory_.GetWeakPtr(); |
| 224 | 225 |
| 225 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( | 226 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( |
| 226 "Media.GpuVideoDecoderInitializeStatus", | 227 "Media.GpuVideoDecoderInitializeStatus", |
| 227 BindToCurrentLoop(orig_status_cb)); | 228 BindToCurrentLoop(orig_status_cb)); |
| 228 DCHECK(!demuxer_stream_); | 229 DCHECK(!demuxer_stream_); |
| 229 | 230 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 709 |
| 709 state_ = kError; | 710 state_ = kError; |
| 710 | 711 |
| 711 if (!pending_read_cb_.is_null()) { | 712 if (!pending_read_cb_.is_null()) { |
| 712 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); | 713 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); |
| 713 return; | 714 return; |
| 714 } | 715 } |
| 715 } | 716 } |
| 716 | 717 |
| 717 } // namespace media | 718 } // namespace media |
| OLD | NEW |