OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 // | |
5 // This file contains an implementation of a class that provides H264 decode | |
6 // support for use with VAAPI hardware video decode acceleration on Intel | |
7 // systems. | |
8 | |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | |
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | |
11 | |
12 #include "h264_parser.h" | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
these includes are unstylish (belong in order belo
Pawel Osciak
2012/03/21 18:40:35
Oh, I thought those fell into tightly related modu
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
13 #include "h264_dpb.h" | |
14 | |
15 #include <vector> | |
16 #include <queue> | |
17 | |
18 #include <GL/glx.h> | |
19 | |
20 #include "base/lazy_instance.h" | |
21 #include "base/memory/linked_ptr.h" | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Any reason you didn't use linked_ptr for PicsVecto
Pawel Osciak
2012/03/21 18:40:35
Yes, this: http://www.corp.google.com/eng/doc/devg
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
I was surprised b/c you used linked_ptr elsewhere
Pawel Osciak
2012/04/05 10:37:20
Than one instance of linked_ptr was actually becau
| |
22 #include "base/memory/ref_counted.h" | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
unused?
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
23 #include "base/memory/scoped_ptr.h" | |
24 #include "base/message_loop.h" | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
fwd-declare
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
25 #include "media/base/video_decoder_config.h" | |
26 | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
extra \n
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
27 #include "third_party/libva/va/va.h" | |
28 | |
29 // A H264 decoder for use for VA-API-specific decoding. Provides features not | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/A/An/ (here and elsewhere in comments in this C
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
30 // supported by libva, including stream parsing, reference picture management | |
31 // and other operations not supported by the HW codec. | |
32 // | |
33 // Provides functionality to allow plugging VAAPI HW acceleration into the | |
34 // VDA framework. | |
35 // | |
36 // Clients of this class are expected to pass H264 Annex-B byte stream and | |
37 // will receive decoded pictures via client-provided |OutputPicCallbackPtr|. | |
38 // Supports zero-copy output to client-provided textures, which are bound | |
39 // using the Texture From Pixmap GLX extension. | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
is this really a concern of this class?
Pawel Osciak
2012/03/21 18:40:35
Well, binding is related to VASurfaces. I can have
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
I meant that pixmapness is not part of the API.
C
Pawel Osciak
2012/04/05 10:37:20
Ah ok, so you are saying just remove it from the d
| |
40 // | |
41 // If used for multi-threaded decoding, some of the functions have to be | |
42 // called on the display thread (i.e. the thread that has the GLX context | |
43 // passed to Initialize() set as current), as specified below. This thread | |
44 // is further referred to as "GLX thread", while decoding thread is referred | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Is there some reason not to refer to this as the C
Pawel Osciak
2012/03/21 18:40:35
Not sure if we are on the same page. GLX thread is
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
"ChildThread" means the "main" thread of a chromiu
Pawel Osciak
2012/04/05 10:37:20
Right. The decoder thread is a ChildThread of the
Ami GONE FROM CHROMIUM
2012/04/09 02:41:47
No. The Decoder thread is not "a ChildThread of".
| |
45 // to as "decoder thread". If not specified otherwise, a function is to be | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
I think this is a problematic contract. Is there s
Pawel Osciak
2012/03/21 18:40:35
No and I'm annotating everything anyway. I'll remo
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
46 // called on the decoder thread. | |
47 class VaapiH264Decoder { | |
48 public: | |
49 | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
extra newline
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
50 // Callback to be invoked on the client when a picture | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
sentence is cut off
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
51 // Arguments: client-private pointer (provided by client in Initialize()), | |
52 // input buffer id, output buffer id (both provided by the client at the time | |
53 // of Decode() and AssignPictureBuffer() calls). | |
54 // Client is expected to call PutPicToTexture() to when it is ready to | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Please make an editing pass on this paragraph to e
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
55 // output to sync the contents. | |
56 typedef void (*OutputPicCallbackPtr)(void*, int32, int32); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Why not instead
typedef base::Callback<void(int32
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
57 | |
58 // Decode result codes. | |
59 enum DecResult { | |
60 kDecError, // error while decoding | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
in-line comments require 2 spaces before the //.
(
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Chromium style eschews abbreviations. I'm not com
Pawel Osciak
2012/04/05 10:37:20
Done.
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
61 // TODO posciak: add unsupported stream error (for now treated as error in | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
can this be done in this CL?
(if not, can you remo
Pawel Osciak
2012/04/05 10:37:20
We talked about this and decided that falling back
| |
62 // decoding). | |
63 //KStreamError, // error in stream | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/KS/kS/
(also missing space before k)
| |
64 kReadyToDecode, // successfully initialized | |
65 kDecodedFrame, // successfully decoded a frame | |
66 kNeedMoreStreamData, // need more stream data to decode the next frame | |
67 kNoOutputAvailable, // waiting for the client to free up output surfaces | |
68 }; | |
69 | |
70 VaapiH264Decoder(); | |
71 ~VaapiH264Decoder(); | |
72 | |
73 // Initializes and sets up libva connection and GL/X11 resources. | |
74 // |msg_loop| is where the |output_pic_callback| should be posted, with | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Is msg_loop the decoder thread or the child thread
Pawel Osciak
2012/03/21 18:40:35
Decoder thread is the child thread. The main threa
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
See elsewhere (and replay my original comment)
| |
75 // |arg| as its first argument. | |
76 // Must be called on the GLX thread with decoder thread not yet running. | |
77 bool Initialize(media::VideoCodecProfile profile, | |
78 Display* x_display, | |
79 GLXContext glx_context, | |
80 MessageLoop* msg_loop, | |
81 OutputPicCallbackPtr output_pic_callback, | |
82 void* arg); | |
83 void Destroy(); | |
84 | |
85 // TODO reorganize private/public | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Yes, please. (it's hard to review this class with
Pawel Osciak
2012/03/21 18:40:35
Haha, can't believe I left this here ;)
| |
86 | |
87 // Notify the decoder that this output buffer has been consumed and | |
88 // can be reused (overwritten). | |
89 // Must be run on the decoder thread. | |
90 void ReusePictureBuffer(int32 picture_buffer_id); | |
91 | |
92 // Give a new picture buffer (texture) to decoder for use. | |
93 // Must be run on the GLX thread with decoder thread not yet running. | |
94 bool AssignPictureBuffer(int32 picture_buffer_id, uint32 texture_id); | |
95 | |
96 // Sync the data so that the texture for given |picture_buffer_id| can | |
97 // be displayed. | |
98 // Must be run on the GLX thread. | |
99 bool PutPicToTexture(int32 picture_buffer_id); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
See comment elsewhere, but hopefully this can be i
Pawel Osciak
2012/03/21 18:40:35
I'll respond in the other place.
| |
100 | |
101 // Have the decoder flush its state and trigger output of all previously | |
102 // decoded pictures via OutputPicCallback. | |
103 bool Flush(); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
what's the ret value?
Pawel Osciak
2012/03/21 18:40:35
Could've errored out at OutPic. I'll document.
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
104 | |
105 // Called while decoding. | |
106 // Stop decoding, discarding all remaining input/output, but do not flush | |
107 // state, so the playback of the same stream can be resumed (possibly from | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
What state needs to be kept across Reset()? I am
Pawel Osciak
2012/03/21 18:40:35
Quite a bit, actually. SPSes and PPSes have to be
| |
108 // another location). | |
109 void Reset(); | |
110 | |
111 // Set current stream data pointer to |ptr| and |size|. | |
112 // Must be run on decoder thread. | |
113 void SetStream(uint8* ptr, size_t size); | |
114 | |
115 // Start parsing stream to detect picture sizes. Does not produce any | |
116 // decoded pictures and can be called without providing output textures. | |
117 // Also to be used after Reset() to find a suitable location in the | |
118 // stream to resume playback from. | |
119 DecResult DecodeInitial(int32 input_id); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Any reason not to make this part of SetStream?
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Why is input_id a param to this & DecodeOneFrame i
Pawel Osciak
2012/03/21 18:40:35
To support having more than one frame in one strea
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
While a stream chunk may contain multiple NALUs, i
Pawel Osciak
2012/04/05 10:37:20
Ok, but I'd prefer to leave it this way. We could
Ami GONE FROM CHROMIUM
2012/04/09 02:41:47
Doing so would make no sense. BBID is an identifi
| |
120 | |
121 // Runs until a frame is decoded or end of provided stream data buffer | |
122 // is reached. Decoded pictures will be returned asynchronously via | |
123 // OutputPicCallback. | |
124 DecResult DecodeOneFrame(int32 input_id); | |
125 | |
126 // Return dimensions for output buffer (texture) allocation. | |
127 // Valid only after a successful Initialize(). | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/Initialize/DecodeInitial/ ?
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
128 int pic_height() { return pic_height_; } | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/pic_// here and below.
Pawel Osciak
2012/04/05 10:37:20
decoder->pic_height() feels more informative to me
| |
129 int pic_width() { return pic_width_; } | |
130 | |
131 // Return the number of output pictures/textures required for decoding. | |
132 // Valid after a successful Initialize(). | |
133 static int GetRequiredNumOfPictures(); | |
134 | |
135 private: | |
136 | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
extra \n
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
137 // We need to keep at least kDPBMaxSize pictures in DPB for | |
138 // reference/to display later and an additional one for the one currently | |
139 // being decoded. We also ask for some additional ones since VDA needs | |
140 // to accumulate a few ready-to-output pictures before it actually starts | |
141 // displaying and giving them back. | |
142 enum { kNumReqPictures = H264DPB::kDPBMaxSize + 6 }; | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/6/1 + media::limits::kMaxVideoFrames/
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Isn't this an excessive amount of memory to be hol
Pawel Osciak
2012/03/21 18:40:35
I need to be able to keep at least H264DPB::kDPBMa
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
I get that you need to keep that many frames in so
Pawel Osciak
2012/04/05 10:37:20
I need to keep decompressed images.
As for keeping
| |
143 | |
144 // Internal state of the decoder. | |
145 enum State { | |
146 kUninitialized, // Initialize() not yet called | |
147 kInitialized, // Initialize() called, pictures requested | |
148 kDecoding, // DecodeInitial() successful, output surfaces allocated | |
149 kAfterReset, // after Reset() during decoding | |
150 kError, // error in kDecoding state | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
initial caps above please
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
151 }; | |
152 | |
153 // Verify that libva has been loaded successfully and provides required | |
154 // functions. | |
155 bool HasHWSupport(); | |
156 | |
157 State state_; | |
158 | |
159 // A frame has been decoded as the result of the last DecodeOneFrame() call. | |
160 bool frame_decoded_; | |
161 | |
162 // Process H264 stream structures. | |
163 bool ProcessSPS(int sps_id); | |
164 bool ProcessPPS(int pps_id); | |
165 bool ProcessSlice(H264SliceHeader* slice_hdr); | |
166 | |
167 // Initialize the current picture according to data in |slice_hdr|. | |
168 bool InitCurrPicture(H264SliceHeader* slice_hdr); | |
169 | |
170 // Calculate picture order counts for the new picture | |
171 // on initialization of a new frame (see spec). | |
172 bool CalculatePicOrderCounts(H264SliceHeader* slice_hdr); | |
173 | |
174 // Update PicNum values in pictures stored in DPB on creation of new | |
175 // frame (see spec). | |
176 void UpdatePicNums(); | |
177 | |
178 // Construct initial reference picture lists for use in decoding of | |
179 // P and B pictures (see 8.2.4 in spec). | |
180 void ConstructReferencePicListsP(H264SliceHeader* slice_hdr); | |
181 void ConstructReferencePicListsB(H264SliceHeader* slice_hdr); | |
182 | |
183 // Helper functions for reference list construction, per spec. | |
184 int PicNumF(H264Picture *pic); | |
185 int LongTermPicNumF(H264Picture *pic); | |
186 | |
187 // Perform the reference picture lists' modification (reordering), as | |
188 // specified in spec (8.2.4). | |
189 // | |
190 // |list| indicates list number and should be either 0 or 1. | |
191 bool ModifyReferencePicList(H264SliceHeader *slice_hdr, int list); | |
192 | |
193 // Perform reference picture memory management operations (marking/unmarking | |
194 // of reference pictures, long term picture management, discarding, etc.). | |
195 // See 8.2.5 in spec. | |
196 bool HandleMemoryManagementOps(); | |
197 void ReferencePictureMarking(); | |
198 | |
199 // Start processing a new frame. | |
200 bool StartNewFrame(H264SliceHeader* slice_hdr); | |
201 | |
202 // All data for a frame received, process it and decode. | |
203 bool FinishPrevFrameIfPresent(); | |
204 | |
205 // Called after decoding, performs all operations to be done after decoding, | |
206 // including DPB management, reference picture marking and memory management | |
207 // operations. | |
208 // This will also output a picture if one is ready for output. | |
209 bool FinishPicture(); | |
210 | |
211 // Convert VideoCodecProfile to VAProfile and set it as active. | |
212 bool SetProfile(media::VideoCodecProfile profile); | |
213 | |
214 // Parser in use. | |
215 H264Parser parser_; | |
216 | |
217 // DPB in use. | |
218 H264DPB dpb_; | |
219 | |
220 // Picture currently being processed/decoded. | |
221 scoped_ptr<H264Picture> curr_pic_; | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Why not a simple member?
Pawel Osciak
2012/03/21 18:40:35
You mean a pointer?
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
Retract comment (I misunderstood the member's use)
| |
222 | |
223 // Reference picture lists, constructed for each picture before decoding. | |
224 // Those lists are not owners of the pointers (DPB is). | |
225 PicsVector RefPicList0_; | |
226 PicsVector RefPicList1_; | |
227 | |
228 // Global state values, needed in decoding. See spec. | |
229 int MaxPicOrderCntLsb_; | |
230 int MaxFrameNum_; | |
231 int MaxPicNum_; | |
232 int MaxLongTermFrameIdx_; | |
233 | |
234 int frame_num_; | |
235 int prev_frame_num_; | |
236 | |
237 // Values related to previously decoded reference picture. | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Does it not make sense to have a
H264Picture last
Pawel Osciak
2012/03/21 18:40:35
I was deliberating it for quite some time, but I f
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
A copy wouldn't involve mgmt pain and the wasted m
Pawel Osciak
2012/04/05 10:37:20
Ok, so I'm leaving it as is. I think we prefer cop
Ami GONE FROM CHROMIUM
2012/04/09 02:41:47
Not really; copying consecutive O(100) bytes per f
| |
238 bool prev_ref_has_memmgmnt5_; | |
239 int prev_ref_TopFieldOrderCnt_; | |
240 int prev_ref_PicOrderCntMsb_; | |
241 int prev_ref_pic_order_cnt_lsb_; | |
242 H264Picture::Field prev_ref_field_; | |
243 | |
244 // Currently active SPS and PPS. | |
245 int curr_sps_id_; | |
246 int curr_pps_id_; | |
247 | |
248 // Output picture size. | |
249 int pic_width_; | |
250 int pic_height_; | |
251 | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
extra \n
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
252 | |
253 // Vaapi-related functions. | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
style guide requires functions before members.
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
254 | |
255 // Allocates VASurfaces and creates a VAContext for them. | |
256 bool CreateVASurfaces(); | |
257 | |
258 // Destroys allocated VASurfaces and related VAContext. | |
259 void DestroyVASurfaces(); | |
260 | |
261 // These queue up data for HW decoder to be commited on running HW decode. | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
committed
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
262 bool SendPPS(); | |
263 bool SendIQMatrix(); | |
264 bool SendVASliceParam(H264SliceHeader* slice_hdr); | |
265 bool SendSliceData(void* ptr, size_t size); | |
266 bool QueueSlice(H264SliceHeader* slice_hdr); | |
267 | |
268 // Helper methods for filling HW structures. | |
269 void FillVAPicture(VAPictureH264 *va_pic, H264Picture* pic); | |
270 int FillVARefFramesFromDPB(VAPictureH264 *va_pics); | |
271 | |
272 // Commits all pending data for HW decoder and starts HW decoder. | |
273 bool DecodePicture(); | |
274 | |
275 // Notifies client that a picture is ready for output. | |
276 bool OutputPic(H264Picture* pic); | |
277 | |
278 // Data queued up for HW decoder, to be commited on next HW decode. | |
279 std::queue<VABufferID> pending_slice_bufs_; | |
280 std::queue<VABufferID> pending_va_bufs_; | |
281 | |
282 // Manages binding of a client-provided output buffer (texture) | |
283 // to VASurface. | |
284 struct DecodeSurface { | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
fwd-declare here and define in .cc file?
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
There is private state and methods in this, so it'
Pawel Osciak
2012/03/21 18:40:35
Yeah... I really hoped to avoid class and getter/s
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
285 public: | |
286 VASurfaceID va_surface_id; | |
287 | |
288 // Client-provided ids. | |
289 int32 input_id; | |
290 int32 picture_buffer_id; | |
291 uint32 texture_id; | |
292 | |
293 // Available for decoding (data no longer used for reference or output). | |
294 bool available; | |
295 | |
296 // PicOrderCount | |
297 int poc; | |
298 | |
299 // Pixmaps bound to this texture. | |
300 Pixmap x_pixmap; | |
301 GLXPixmap glx_pixmap; | |
302 | |
303 DecodeSurface(); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
move these to the top of the class
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
304 ~DecodeSurface(); | |
305 | |
306 // Bind the surface to a texture of the given |width| and |height|, | |
307 // allocating pixmaps as needed. | |
308 bool BindToTexture(int width, int height); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
inline into ctor and replace bool ret value with s
Pawel Osciak
2012/03/21 18:40:35
The class is constructed before we can bind, that'
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
I don't understand the relationship between this c
Pawel Osciak
2012/04/05 10:37:20
Yeah, sorry, too many changes and I was thinking a
| |
309 | |
310 // Unbind surface from texture and deallocate resources. | |
311 void UnbindFromTexture(); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
inline into dtor
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
312 | |
313 // Called before output to sync texture contents with the results | |
314 // of decode. | |
315 bool Sync(); | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
not defined?
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
316 | |
317 // Initialize/destroy static state of this class (X Display and current | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
Why static? Instead leave ownership w/ decoder ob
Pawel Osciak
2012/03/21 18:40:35
Only because it isn't related to decoder, just to
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
The fact that only the decoder knows when to do th
Pawel Osciak
2012/04/05 10:37:20
Yes, that was my intention. FBConfig is framebuffe
| |
318 // FBConfig). | |
319 static bool Initialize(Display* x_display); | |
320 static void Destroy(); | |
321 | |
322 private: | |
323 static Display* x_display_; | |
324 // Used for texture binding. | |
325 static base::LazyInstance<GLXFBConfig> fb_config_; | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
I think LazyInstance can be dropped.
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
326 }; | |
327 | |
328 // Maps output_buffer_id to a decode surface. Used to look up surfaces | |
329 // on requests from the client. | |
330 typedef std::map<int32, linked_ptr<DecodeSurface> > DecodeSurfaces; | |
331 DecodeSurfaces decode_surfaces_; | |
332 | |
333 // Number of decode surface currently available for decoding. | |
334 int num_available_decode_surfaces_; | |
335 | |
336 // Maps decode surfaces to PicOrderCount, used to look up output buffers | |
337 // when a decision to output a picture has been made. | |
338 typedef std::map<int, DecodeSurface*> POCToDecodeSurfaces; | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
why not a linked_ptr?
Pawel Osciak
2012/03/21 18:40:35
See my previous comment, but I guess you really pr
Ami GONE FROM CHROMIUM
2012/03/22 17:01:36
I was unclear. I don't want linked_ptr. I was co
Pawel Osciak
2012/04/05 10:37:20
I actually almost finished converting to IDMap, bu
Ami GONE FROM CHROMIUM
2012/04/09 02:41:47
Do what you feel results in most-readable code. I
| |
339 POCToDecodeSurfaces poc_to_decode_surfaces_; | |
340 | |
341 // The id of current input buffer, which will be associated with an | |
342 // output picture if a frame is decoded successfully. | |
343 int32 curr_input_id_; | |
344 | |
345 // X/GLX handles. | |
346 Display* x_display_; | |
347 GLXContext parent_glx_context_; | |
348 | |
349 // VA handles. | |
350 VADisplay va_display_; | |
351 VAConfigID va_config_id_; | |
352 VAContextID va_context_id_; | |
353 VAProfile profile_; | |
354 | |
355 // Allocated VASurfaces. | |
356 VASurfaceID va_surface_ids_[kNumReqPictures]; | |
357 // The number of the above surfaces successfully allocated and assigned | |
358 // to output buffers. | |
359 int num_assigned_vaapi_surfaces_; | |
360 | |
361 // Assing a surface to PicOrderCount, removing it from the available surfaces | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/Assing/Assign/
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
362 // pool. Used when starting processing a new picture to get a free surface | |
363 // to decode too. | |
Ami GONE FROM CHROMIUM
2012/03/21 13:16:24
s/too/to/
Pawel Osciak
2012/04/05 10:37:20
Done.
| |
364 bool AssignSurfaceToPoC(int poc); | |
365 | |
366 // Unassign a surface when the data it contains is not needed for reference | |
367 // or display anymore, thus returning it to the available surfaces pool. | |
368 void UnassignSurfaceFromPoC(int poc); | |
369 | |
370 // For posting the OutputPicCallback, provided by the client. | |
371 MessageLoop* msg_loop_; | |
372 void* output_pic_callback_arg_; | |
373 OutputPicCallbackPtr output_pic_callback_; | |
374 | |
375 DISALLOW_COPY_AND_ASSIGN(VaapiH264Decoder); | |
376 }; | |
377 | |
378 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | |
379 | |
OLD | NEW |