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 26 matching lines...) Expand all Loading... | |
37 GpuVideoDecoder::BufferPair::~BufferPair() {} | 37 GpuVideoDecoder::BufferPair::~BufferPair() {} |
38 | 38 |
39 GpuVideoDecoder::BufferData::BufferData( | 39 GpuVideoDecoder::BufferData::BufferData( |
40 int32 bbid, base::TimeDelta ts, const gfx::Size& ns) | 40 int32 bbid, base::TimeDelta ts, const gfx::Size& ns) |
41 : bitstream_buffer_id(bbid), timestamp(ts), natural_size(ns) { | 41 : bitstream_buffer_id(bbid), timestamp(ts), natural_size(ns) { |
42 } | 42 } |
43 | 43 |
44 GpuVideoDecoder::BufferData::~BufferData() {} | 44 GpuVideoDecoder::BufferData::~BufferData() {} |
45 | 45 |
46 GpuVideoDecoder::GpuVideoDecoder( | 46 GpuVideoDecoder::GpuVideoDecoder( |
47 MessageLoop* message_loop, | 47 const MessageLoopCB& message_loop_cb, |
48 MessageLoop* vda_loop, | 48 const scoped_refptr<base::MessageLoopProxy>& vda_loop_proxy, |
49 const scoped_refptr<Factories>& factories) | 49 const scoped_refptr<Factories>& factories) |
50 : gvd_loop_proxy_(message_loop->message_loop_proxy()), | 50 : message_loop_factory_cb_(message_loop_cb), |
51 vda_loop_proxy_(vda_loop->message_loop_proxy()), | 51 gvd_loop_proxy_(NULL), |
52 vda_loop_proxy_(vda_loop_proxy), | |
52 factories_(factories), | 53 factories_(factories), |
53 state_(kNormal), | 54 state_(kNormal), |
54 demuxer_read_in_progress_(false), | 55 demuxer_read_in_progress_(false), |
55 decoder_texture_target_(0), | 56 decoder_texture_target_(0), |
56 next_picture_buffer_id_(0), | 57 next_picture_buffer_id_(0), |
57 next_bitstream_buffer_id_(0), | 58 next_bitstream_buffer_id_(0), |
58 shutting_down_(false), | 59 shutting_down_(false), |
59 error_occured_(false) { | 60 error_occured_(false) { |
60 DCHECK(gvd_loop_proxy_ && factories_); | 61 DCHECK(gvd_loop_proxy_ && factories_); |
61 } | 62 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 closure.Run(); | 107 closure.Run(); |
107 return; | 108 return; |
108 } | 109 } |
109 DestroyVDA(); | 110 DestroyVDA(); |
110 closure.Run(); | 111 closure.Run(); |
111 } | 112 } |
112 | 113 |
113 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, | 114 void GpuVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream, |
114 const PipelineStatusCB& orig_status_cb, | 115 const PipelineStatusCB& orig_status_cb, |
115 const StatisticsCB& statistics_cb) { | 116 const StatisticsCB& statistics_cb) { |
116 if (!gvd_loop_proxy_->BelongsToCurrentThread()) { | 117 if (!gvd_loop_proxy_) { |
118 gvd_loop_proxy_ = base::ResetAndReturn(&message_loop_factory_cb_).Run(); | |
117 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 119 gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
118 &GpuVideoDecoder::Initialize, | 120 &GpuVideoDecoder::Initialize, |
119 this, stream, orig_status_cb, statistics_cb)); | 121 this, stream, orig_status_cb, statistics_cb)); |
120 return; | 122 return; |
121 } | 123 } |
122 | 124 |
Ami GONE FROM CHROMIUM
2012/08/10 04:38:06
DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
xhwang
2012/08/10 19:33:33
Done.
| |
123 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( | 125 PipelineStatusCB status_cb = CreateUMAReportingPipelineCB( |
124 "Media.GpuVideoDecoderInitializeStatus", orig_status_cb); | 126 "Media.GpuVideoDecoderInitializeStatus", orig_status_cb); |
125 | 127 |
126 DCHECK(!demuxer_stream_); | 128 DCHECK(!demuxer_stream_); |
127 if (!stream) { | 129 if (!stream) { |
128 status_cb.Run(PIPELINE_ERROR_DECODE); | 130 status_cb.Run(PIPELINE_ERROR_DECODE); |
129 return; | 131 return; |
130 } | 132 } |
131 | 133 |
132 const VideoDecoderConfig& config = stream->video_decoder_config(); | 134 const VideoDecoderConfig& config = stream->video_decoder_config(); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 | 560 |
559 error_occured_ = true; | 561 error_occured_ = true; |
560 | 562 |
561 if (!pending_read_cb_.is_null()) { | 563 if (!pending_read_cb_.is_null()) { |
562 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); | 564 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); |
563 return; | 565 return; |
564 } | 566 } |
565 } | 567 } |
566 | 568 |
567 } // namespace media | 569 } // namespace media |
OLD | NEW |