Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 13813016: Remove reference counting from media::Demuxer and friends. (Closed) Base URL: http://git.chromium.org/chromium/src.git@vd_scoped
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns) 155 int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns)
156 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr), 156 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr),
157 natural_size(ns) { 157 natural_size(ns) {
158 } 158 }
159 159
160 GpuVideoDecoder::BufferData::~BufferData() {} 160 GpuVideoDecoder::BufferData::~BufferData() {}
161 161
162 GpuVideoDecoder::GpuVideoDecoder( 162 GpuVideoDecoder::GpuVideoDecoder(
163 const scoped_refptr<base::MessageLoopProxy>& message_loop, 163 const scoped_refptr<base::MessageLoopProxy>& message_loop,
164 const scoped_refptr<Factories>& factories) 164 const scoped_refptr<Factories>& factories)
165 : gvd_loop_proxy_(message_loop), 165 : demuxer_stream_(NULL),
166 gvd_loop_proxy_(message_loop),
166 weak_factory_(this), 167 weak_factory_(this),
167 vda_loop_proxy_(factories->GetMessageLoop()), 168 vda_loop_proxy_(factories->GetMessageLoop()),
168 factories_(factories), 169 factories_(factories),
169 state_(kNormal), 170 state_(kNormal),
170 demuxer_read_in_progress_(false), 171 demuxer_read_in_progress_(false),
171 decoder_texture_target_(0), 172 decoder_texture_target_(0),
172 next_picture_buffer_id_(0), 173 next_picture_buffer_id_(0),
173 next_bitstream_buffer_id_(0), 174 next_bitstream_buffer_id_(0),
174 error_occured_(false), 175 error_occured_(false),
175 available_pictures_(-1) { 176 available_pictures_(-1) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (vda_.get()) 215 if (vda_.get())
215 DestroyVDA(); 216 DestroyVDA();
216 if (!pending_read_cb_.is_null()) 217 if (!pending_read_cb_.is_null())
217 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); 218 EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame());
218 if (!pending_reset_cb_.is_null()) 219 if (!pending_reset_cb_.is_null())
219 base::ResetAndReturn(&pending_reset_cb_).Run(); 220 base::ResetAndReturn(&pending_reset_cb_).Run();
220 demuxer_stream_ = NULL; 221 demuxer_stream_ = NULL;
221 BindToCurrentLoop(closure).Run(); 222 BindToCurrentLoop(closure).Run();
222 } 223 }
223 224
224 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, 225 void GpuVideoDecoder::Initialize(DemuxerStream* stream,
225 const PipelineStatusCB& orig_status_cb, 226 const PipelineStatusCB& orig_status_cb,
226 const StatisticsCB& statistics_cb) { 227 const StatisticsCB& statistics_cb) {
227 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); 228 DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
228 weak_this_ = weak_factory_.GetWeakPtr(); 229 weak_this_ = weak_factory_.GetWeakPtr();
229 230
230 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( 231 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB(
231 "Media.GpuVideoDecoderInitializeStatus", 232 "Media.GpuVideoDecoderInitializeStatus",
232 BindToCurrentLoop(orig_status_cb)); 233 BindToCurrentLoop(orig_status_cb));
233 DCHECK(!demuxer_stream_); 234 DCHECK(!demuxer_stream_);
234 235
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 703
703 error_occured_ = true; 704 error_occured_ = true;
704 705
705 if (!pending_read_cb_.is_null()) { 706 if (!pending_read_cb_.is_null()) {
706 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); 707 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL);
707 return; 708 return;
708 } 709 }
709 } 710 }
710 711
711 } // namespace media 712 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698