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 // This file contains an implementation of a class that provides H264 decode | 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 | 6 // support for use with VAAPI hardware video decode acceleration on Intel |
7 // systems. | 7 // systems. |
8 | 8 |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // Return dimensions for output buffer (texture) allocation. | 123 // Return dimensions for output buffer (texture) allocation. |
124 // Valid only after a successful DecodeInitial(). | 124 // Valid only after a successful DecodeInitial(). |
125 int pic_height() { return pic_height_; } | 125 int pic_height() { return pic_height_; } |
126 int pic_width() { return pic_width_; } | 126 int pic_width() { return pic_width_; } |
127 | 127 |
128 // Return the number of output pictures required for decoding. | 128 // Return the number of output pictures required for decoding. |
129 // Valid after a successful DecodeInitial(). | 129 // Valid after a successful DecodeInitial(). |
130 static size_t GetRequiredNumOfPictures(); | 130 static size_t GetRequiredNumOfPictures(); |
131 | 131 |
132 // Do any necessary initialization before the sandbox is enabled. | |
133 static void PreSandboxInitialization(); | |
134 | |
135 // Lazily initialize static data after sandbox is enabled. Return false on | |
136 // init failure. | |
137 static bool PostSandboxInitialization(); | |
138 | |
139 private: | 132 private: |
140 // We need to keep at least kDPBMaxSize pictures in DPB for | 133 // We need to keep at least kDPBMaxSize pictures in DPB for |
141 // reference/to display later and an additional one for the one currently | 134 // reference/to display later and an additional one for the one currently |
142 // being decoded. We also ask for some additional ones since VDA needs | 135 // being decoded. We also ask for some additional ones since VDA needs |
143 // to accumulate a few ready-to-output pictures before it actually starts | 136 // to accumulate a few ready-to-output pictures before it actually starts |
144 // displaying and giving them back. +2 instead of +1 because of subjective | 137 // displaying and giving them back. +2 instead of +1 because of subjective |
145 // smoothness improvement during testing. | 138 // smoothness improvement during testing. |
146 enum { kNumReqPictures = H264DPB::kDPBMaxSize + | 139 enum { kNumReqPictures = H264DPB::kDPBMaxSize + |
147 media::limits::kMaxVideoFrames + 2 }; | 140 media::limits::kMaxVideoFrames + 2 }; |
148 | 141 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 VAConfigID va_config_id_; | 322 VAConfigID va_config_id_; |
330 VAContextID va_context_id_; | 323 VAContextID va_context_id_; |
331 VAProfile profile_; | 324 VAProfile profile_; |
332 | 325 |
333 // Allocated VASurfaces. | 326 // Allocated VASurfaces. |
334 VASurfaceID va_surface_ids_[kNumReqPictures]; | 327 VASurfaceID va_surface_ids_[kNumReqPictures]; |
335 | 328 |
336 // Called by decoder when a picture should be outputted. | 329 // Called by decoder when a picture should be outputted. |
337 OutputPicCB output_pic_cb_; | 330 OutputPicCB output_pic_cb_; |
338 | 331 |
339 // Has static initialization of pre-sandbox components completed successfully? | |
340 static bool pre_sandbox_init_done_; | |
341 | |
342 DISALLOW_COPY_AND_ASSIGN(VaapiH264Decoder); | 332 DISALLOW_COPY_AND_ASSIGN(VaapiH264Decoder); |
343 }; | 333 }; |
344 | 334 |
345 } // namespace content | 335 } // namespace content |
346 | 336 |
347 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | 337 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ |
OLD | NEW |