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

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

Issue 10447035: Introducing DecoderBuffer and general Buffer cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Buffer Bonanza! Created 8 years, 6 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
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 <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 11
12 #include "media/base/decoder_buffer.h"
scherkus (not reviewing) 2012/05/26 01:36:32 fwd decl instead?
DaleCurtis 2012/05/29 21:17:01 Done.
12 #include "media/base/pipeline_status.h" 13 #include "media/base/pipeline_status.h"
13 #include "media/base/video_decoder.h" 14 #include "media/base/video_decoder.h"
14 #include "media/video/video_decode_accelerator.h" 15 #include "media/video/video_decode_accelerator.h"
15 16
16 class MessageLoop; 17 class MessageLoop;
17 template <class T> class scoped_refptr; 18 template <class T> class scoped_refptr;
18 namespace base { 19 namespace base {
19 class MessageLoopProxy; 20 class MessageLoopProxy;
20 class SharedMemory; 21 class SharedMemory;
21 } 22 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // enough). 92 // enough).
92 kDrainingDecoder, 93 kDrainingDecoder,
93 kDecoderDrained, 94 kDecoderDrained,
94 }; 95 };
95 96
96 // If no demuxer read is in flight and no bitstream buffers are in the 97 // If no demuxer read is in flight and no bitstream buffers are in the
97 // decoder, kick some off demuxing/decoding. 98 // decoder, kick some off demuxing/decoding.
98 void EnsureDemuxOrDecode(); 99 void EnsureDemuxOrDecode();
99 100
100 // Callback to pass to demuxer_stream_->Read() for receiving encoded bits. 101 // Callback to pass to demuxer_stream_->Read() for receiving encoded bits.
101 void RequestBufferDecode(const scoped_refptr<Buffer>& buffer); 102 void RequestBufferDecode(const scoped_refptr<DecoderBuffer>& buffer);
102 103
103 // Enqueue a frame for later delivery (or drop it on the floor if a 104 // Enqueue a frame for later delivery (or drop it on the floor if a
104 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest 105 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest
105 // ready frame to the client if there is a pending read. A NULL |frame| 106 // ready frame to the client if there is a pending read. A NULL |frame|
106 // merely triggers delivery, and requires the ready_video_frames_ queue not be 107 // merely triggers delivery, and requires the ready_video_frames_ queue not be
107 // empty. 108 // empty.
108 void EnqueueFrameAndTriggerFrameDelivery( 109 void EnqueueFrameAndTriggerFrameDelivery(
109 const scoped_refptr<VideoFrame>& frame); 110 const scoped_refptr<VideoFrame>& frame);
110 111
111 // Indicate the picturebuffer can be reused by the decoder. 112 // Indicate the picturebuffer can be reused by the decoder.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Is a demuxer read in flight? 169 // Is a demuxer read in flight?
169 bool demuxer_read_in_progress_; 170 bool demuxer_read_in_progress_;
170 171
171 // Shared-memory buffer pool. Since allocating SHM segments requires a 172 // Shared-memory buffer pool. Since allocating SHM segments requires a
172 // round-trip to the browser process, we keep allocation out of the 173 // round-trip to the browser process, we keep allocation out of the
173 // steady-state of the decoder. 174 // steady-state of the decoder.
174 std::vector<SHMBuffer*> available_shm_segments_; 175 std::vector<SHMBuffer*> available_shm_segments_;
175 176
176 // Book-keeping variables. 177 // Book-keeping variables.
177 struct BufferPair { 178 struct BufferPair {
178 BufferPair(SHMBuffer* s, const scoped_refptr<Buffer>& b); 179 BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b);
179 ~BufferPair(); 180 ~BufferPair();
180 SHMBuffer* shm_buffer; 181 SHMBuffer* shm_buffer;
181 scoped_refptr<Buffer> buffer; 182 scoped_refptr<DecoderBuffer> buffer;
182 }; 183 };
183 std::map<int32, BufferPair> bitstream_buffers_in_decoder_; 184 std::map<int32, BufferPair> bitstream_buffers_in_decoder_;
184 std::map<int32, PictureBuffer> picture_buffers_in_decoder_; 185 std::map<int32, PictureBuffer> picture_buffers_in_decoder_;
185 186
186 // The texture target used for decoded pictures. 187 // The texture target used for decoded pictures.
187 uint32 decoder_texture_target_; 188 uint32 decoder_texture_target_;
188 189
189 struct BufferTimeData { 190 struct BufferTimeData {
190 BufferTimeData(int32 bbid, base::TimeDelta ts, base::TimeDelta dur); 191 BufferTimeData(int32 bbid, base::TimeDelta ts, base::TimeDelta dur);
191 ~BufferTimeData(); 192 ~BufferTimeData();
(...skipping 15 matching lines...) Expand all
207 208
208 // Indicates decoding error occurred. 209 // Indicates decoding error occurred.
209 bool error_occured_; 210 bool error_occured_;
210 211
211 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); 212 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder);
212 }; 213 };
213 214
214 } // namespace media 215 } // namespace media
215 216
216 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 217 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698