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 |
132 private: | 139 private: |
133 // We need to keep at least kDPBMaxSize pictures in DPB for | 140 // We need to keep at least kDPBMaxSize pictures in DPB for |
134 // reference/to display later and an additional one for the one currently | 141 // reference/to display later and an additional one for the one currently |
135 // being decoded. We also ask for some additional ones since VDA needs | 142 // being decoded. We also ask for some additional ones since VDA needs |
136 // to accumulate a few ready-to-output pictures before it actually starts | 143 // to accumulate a few ready-to-output pictures before it actually starts |
137 // displaying and giving them back. +2 instead of +1 because of subjective | 144 // displaying and giving them back. +2 instead of +1 because of subjective |
138 // smoothness improvement during testing. | 145 // smoothness improvement during testing. |
139 enum { kNumReqPictures = H264DPB::kDPBMaxSize + | 146 enum { kNumReqPictures = H264DPB::kDPBMaxSize + |
140 media::limits::kMaxVideoFrames + 2 }; | 147 media::limits::kMaxVideoFrames + 2 }; |
141 | 148 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 VAConfigID va_config_id_; | 329 VAConfigID va_config_id_; |
323 VAContextID va_context_id_; | 330 VAContextID va_context_id_; |
324 VAProfile profile_; | 331 VAProfile profile_; |
325 | 332 |
326 // Allocated VASurfaces. | 333 // Allocated VASurfaces. |
327 VASurfaceID va_surface_ids_[kNumReqPictures]; | 334 VASurfaceID va_surface_ids_[kNumReqPictures]; |
328 | 335 |
329 // Called by decoder when a picture should be outputted. | 336 // Called by decoder when a picture should be outputted. |
330 OutputPicCB output_pic_cb_; | 337 OutputPicCB output_pic_cb_; |
331 | 338 |
| 339 // Has static initialization of pre-sandbox components completed successfully? |
| 340 static bool pre_sandbox_init_done_; |
| 341 |
332 DISALLOW_COPY_AND_ASSIGN(VaapiH264Decoder); | 342 DISALLOW_COPY_AND_ASSIGN(VaapiH264Decoder); |
333 }; | 343 }; |
334 | 344 |
335 } // namespace content | 345 } // namespace content |
336 | 346 |
337 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ | 347 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_H264_DECODER_H_ |
OLD | NEW |