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

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: s/2011/2012/ 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
« 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 <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 11
12 #include "media/base/pipeline_status.h" 12 #include "media/base/pipeline_status.h"
13 #include "media/base/video_decoder.h" 13 #include "media/base/video_decoder.h"
14 #include "media/video/video_decode_accelerator.h" 14 #include "media/video/video_decode_accelerator.h"
15 15
16 class MessageLoop; 16 class MessageLoop;
17 template <class T> class scoped_refptr; 17 template <class T> class scoped_refptr;
18 namespace base { 18 namespace base {
19 class MessageLoopProxy; 19 class MessageLoopProxy;
20 class SharedMemory; 20 class SharedMemory;
21 } 21 }
22 22
23 namespace media { 23 namespace media {
24 24
25 class DecoderBuffer;
26
25 // GPU-accelerated video decoder implementation. Relies on 27 // GPU-accelerated video decoder implementation. Relies on
26 // AcceleratedVideoDecoderMsg_Decode and friends. 28 // AcceleratedVideoDecoderMsg_Decode and friends.
27 // All methods internally trampoline to the |message_loop| passed to the ctor. 29 // All methods internally trampoline to the |message_loop| passed to the ctor.
28 class MEDIA_EXPORT GpuVideoDecoder 30 class MEDIA_EXPORT GpuVideoDecoder
29 : public VideoDecoder, 31 : public VideoDecoder,
30 public VideoDecodeAccelerator::Client { 32 public VideoDecodeAccelerator::Client {
31 public: 33 public:
32 // Helper interface for specifying factories needed to instantiate a 34 // Helper interface for specifying factories needed to instantiate a
33 // GpuVideoDecoder. 35 // GpuVideoDecoder.
34 class MEDIA_EXPORT Factories : public base::RefCountedThreadSafe<Factories> { 36 class MEDIA_EXPORT Factories : public base::RefCountedThreadSafe<Factories> {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // enough). 93 // enough).
92 kDrainingDecoder, 94 kDrainingDecoder,
93 kDecoderDrained, 95 kDecoderDrained,
94 }; 96 };
95 97
96 // If no demuxer read is in flight and no bitstream buffers are in the 98 // If no demuxer read is in flight and no bitstream buffers are in the
97 // decoder, kick some off demuxing/decoding. 99 // decoder, kick some off demuxing/decoding.
98 void EnsureDemuxOrDecode(); 100 void EnsureDemuxOrDecode();
99 101
100 // Callback to pass to demuxer_stream_->Read() for receiving encoded bits. 102 // Callback to pass to demuxer_stream_->Read() for receiving encoded bits.
101 void RequestBufferDecode(const scoped_refptr<Buffer>& buffer); 103 void RequestBufferDecode(const scoped_refptr<DecoderBuffer>& buffer);
102 104
103 // Enqueue a frame for later delivery (or drop it on the floor if a 105 // 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 106 // 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| 107 // 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 108 // merely triggers delivery, and requires the ready_video_frames_ queue not be
107 // empty. 109 // empty.
108 void EnqueueFrameAndTriggerFrameDelivery( 110 void EnqueueFrameAndTriggerFrameDelivery(
109 const scoped_refptr<VideoFrame>& frame); 111 const scoped_refptr<VideoFrame>& frame);
110 112
111 // Indicate the picturebuffer can be reused by the decoder. 113 // 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? 170 // Is a demuxer read in flight?
169 bool demuxer_read_in_progress_; 171 bool demuxer_read_in_progress_;
170 172
171 // Shared-memory buffer pool. Since allocating SHM segments requires a 173 // Shared-memory buffer pool. Since allocating SHM segments requires a
172 // round-trip to the browser process, we keep allocation out of the 174 // round-trip to the browser process, we keep allocation out of the
173 // steady-state of the decoder. 175 // steady-state of the decoder.
174 std::vector<SHMBuffer*> available_shm_segments_; 176 std::vector<SHMBuffer*> available_shm_segments_;
175 177
176 // Book-keeping variables. 178 // Book-keeping variables.
177 struct BufferPair { 179 struct BufferPair {
178 BufferPair(SHMBuffer* s, const scoped_refptr<Buffer>& b); 180 BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b);
179 ~BufferPair(); 181 ~BufferPair();
180 SHMBuffer* shm_buffer; 182 SHMBuffer* shm_buffer;
181 scoped_refptr<Buffer> buffer; 183 scoped_refptr<DecoderBuffer> buffer;
182 }; 184 };
183 std::map<int32, BufferPair> bitstream_buffers_in_decoder_; 185 std::map<int32, BufferPair> bitstream_buffers_in_decoder_;
184 std::map<int32, PictureBuffer> picture_buffers_in_decoder_; 186 std::map<int32, PictureBuffer> picture_buffers_in_decoder_;
185 187
186 // The texture target used for decoded pictures. 188 // The texture target used for decoded pictures.
187 uint32 decoder_texture_target_; 189 uint32 decoder_texture_target_;
188 190
189 struct BufferTimeData { 191 struct BufferTimeData {
190 BufferTimeData(int32 bbid, base::TimeDelta ts, base::TimeDelta dur); 192 BufferTimeData(int32 bbid, base::TimeDelta ts, base::TimeDelta dur);
191 ~BufferTimeData(); 193 ~BufferTimeData();
(...skipping 15 matching lines...) Expand all
207 209
208 // Indicates decoding error occurred. 210 // Indicates decoding error occurred.
209 bool error_occured_; 211 bool error_occured_;
210 212
211 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); 213 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder);
212 }; 214 };
213 215
214 } // namespace media 216 } // namespace media
215 217
216 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 218 #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