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

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

Issue 20136002: Reland r212023 "Rename VideoDecoder::ReadCB to VideoDecoder::DecodeCB." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix content_browsertests failure. Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/ffmpeg_video_decoder_unittest.cc ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 24 matching lines...) Expand all
35 public VideoDecodeAccelerator::Client { 35 public VideoDecodeAccelerator::Client {
36 public: 36 public:
37 // The message loop of |factories| will be saved to |gvd_loop_proxy_|. 37 // The message loop of |factories| will be saved to |gvd_loop_proxy_|.
38 explicit GpuVideoDecoder( 38 explicit GpuVideoDecoder(
39 const scoped_refptr<GpuVideoDecoderFactories>& factories); 39 const scoped_refptr<GpuVideoDecoderFactories>& factories);
40 40
41 // VideoDecoder implementation. 41 // VideoDecoder implementation.
42 virtual void Initialize(const VideoDecoderConfig& config, 42 virtual void Initialize(const VideoDecoderConfig& config,
43 const PipelineStatusCB& status_cb) OVERRIDE; 43 const PipelineStatusCB& status_cb) OVERRIDE;
44 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 44 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
45 const ReadCB& read_cb) OVERRIDE; 45 const DecodeCB& decode_cb) OVERRIDE;
46 virtual void Reset(const base::Closure& closure) OVERRIDE; 46 virtual void Reset(const base::Closure& closure) OVERRIDE;
47 virtual void Stop(const base::Closure& closure) OVERRIDE; 47 virtual void Stop(const base::Closure& closure) OVERRIDE;
48 virtual bool HasAlpha() const OVERRIDE; 48 virtual bool HasAlpha() const OVERRIDE;
49 virtual bool NeedsBitstreamConversion() const OVERRIDE; 49 virtual bool NeedsBitstreamConversion() const OVERRIDE;
50 virtual bool CanReadWithoutStalling() const OVERRIDE; 50 virtual bool CanReadWithoutStalling() const OVERRIDE;
51 51
52 // VideoDecodeAccelerator::Client implementation. 52 // VideoDecodeAccelerator::Client implementation.
53 virtual void NotifyInitializeDone() OVERRIDE; 53 virtual void NotifyInitializeDone() OVERRIDE;
54 virtual void ProvidePictureBuffers(uint32 count, 54 virtual void ProvidePictureBuffers(uint32 count,
55 const gfx::Size& size, 55 const gfx::Size& size,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 base::WeakPtr<GpuVideoDecoder> weak_this_; 118 base::WeakPtr<GpuVideoDecoder> weak_this_;
119 119
120 scoped_refptr<GpuVideoDecoderFactories> factories_; 120 scoped_refptr<GpuVideoDecoderFactories> factories_;
121 121
122 // Populated during Initialize() (on success) and unchanged until an error 122 // Populated during Initialize() (on success) and unchanged until an error
123 // occurs. 123 // occurs.
124 scoped_ptr<VideoDecodeAccelerator> vda_; 124 scoped_ptr<VideoDecodeAccelerator> vda_;
125 125
126 // Callbacks that are !is_null() only during their respective operation being 126 // Callbacks that are !is_null() only during their respective operation being
127 // asynchronously executed. 127 // asynchronously executed.
128 ReadCB pending_read_cb_; 128 DecodeCB pending_decode_cb_;
129 base::Closure pending_reset_cb_; 129 base::Closure pending_reset_cb_;
130 130
131 State state_; 131 State state_;
132 132
133 VideoDecoderConfig config_; 133 VideoDecoderConfig config_;
134 134
135 // Is a demuxer read in flight?
136 bool demuxer_read_in_progress_;
137
138 // Shared-memory buffer pool. Since allocating SHM segments requires a 135 // Shared-memory buffer pool. Since allocating SHM segments requires a
139 // round-trip to the browser process, we keep allocation out of the 136 // round-trip to the browser process, we keep allocation out of the
140 // steady-state of the decoder. 137 // steady-state of the decoder.
141 std::vector<SHMBuffer*> available_shm_segments_; 138 std::vector<SHMBuffer*> available_shm_segments_;
142 139
143 // Book-keeping variables. 140 // Book-keeping variables.
144 struct BufferPair { 141 struct BufferPair {
145 BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b); 142 BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b);
146 ~BufferPair(); 143 ~BufferPair();
147 SHMBuffer* shm_buffer; 144 SHMBuffer* shm_buffer;
148 scoped_refptr<DecoderBuffer> buffer; 145 scoped_refptr<DecoderBuffer> buffer;
149 }; 146 };
150 std::map<int32, BufferPair> bitstream_buffers_in_decoder_; 147 std::map<int32, BufferPair> bitstream_buffers_in_decoder_;
151 std::map<int32, PictureBuffer> assigned_picture_buffers_; 148 std::map<int32, PictureBuffer> assigned_picture_buffers_;
152 std::map<int32, PictureBuffer> dismissed_picture_buffers_; 149 std::map<int32, PictureBuffer> dismissed_picture_buffers_;
153 // PictureBuffers given to us by VDA via PictureReady, which we sent forward 150 // PictureBuffers given to us by VDA via PictureReady, which we sent forward
154 // as VideoFrames to be rendered via read_cb_, and which will be returned 151 // as VideoFrames to be rendered via decode_cb_, and which will be returned
155 // to us via ReusePictureBuffer. 152 // to us via ReusePictureBuffer.
156 std::set<int32> picture_buffers_at_display_; 153 std::set<int32> picture_buffers_at_display_;
157 154
158 // The texture target used for decoded pictures. 155 // The texture target used for decoded pictures.
159 uint32 decoder_texture_target_; 156 uint32 decoder_texture_target_;
160 157
161 struct BufferData { 158 struct BufferData {
162 BufferData(int32 bbid, base::TimeDelta ts, const gfx::Rect& visible_rect, 159 BufferData(int32 bbid, base::TimeDelta ts, const gfx::Rect& visible_rect,
163 const gfx::Size& natural_size); 160 const gfx::Size& natural_size);
164 ~BufferData(); 161 ~BufferData();
165 int32 bitstream_buffer_id; 162 int32 bitstream_buffer_id;
166 base::TimeDelta timestamp; 163 base::TimeDelta timestamp;
167 gfx::Rect visible_rect; 164 gfx::Rect visible_rect;
168 gfx::Size natural_size; 165 gfx::Size natural_size;
169 }; 166 };
170 std::list<BufferData> input_buffer_data_; 167 std::list<BufferData> input_buffer_data_;
171 168
172 // picture_buffer_id and the frame wrapping the corresponding Picture, for 169 // picture_buffer_id and the frame wrapping the corresponding Picture, for
173 // frames that have been decoded but haven't been requested by a Read() yet. 170 // frames that have been decoded but haven't been requested by a Decode() yet.
174 std::list<scoped_refptr<VideoFrame> > ready_video_frames_; 171 std::list<scoped_refptr<VideoFrame> > ready_video_frames_;
175 int32 next_picture_buffer_id_; 172 int32 next_picture_buffer_id_;
176 int32 next_bitstream_buffer_id_; 173 int32 next_bitstream_buffer_id_;
177 174
178 // Set during ProvidePictureBuffers(), used for checking and implementing 175 // Set during ProvidePictureBuffers(), used for checking and implementing
179 // HasAvailableOutputFrames(). 176 // HasAvailableOutputFrames().
180 int available_pictures_; 177 int available_pictures_;
181 178
182 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); 179 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder);
183 }; 180 };
184 181
185 } // namespace media 182 } // namespace media
186 183
187 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 184 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_video_decoder_unittest.cc ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698