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 VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
6 // that utilizes hardware video decoder present on Intel CPUs. | 6 // that utilizes hardware video decoder present on Intel CPUs. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // media::VideoDecodeAccelerator implementation. | 49 // media::VideoDecodeAccelerator implementation. |
50 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; | 50 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; |
51 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 51 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
52 virtual void AssignPictureBuffers( | 52 virtual void AssignPictureBuffers( |
53 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 53 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
54 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 54 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
55 virtual void Flush() OVERRIDE; | 55 virtual void Flush() OVERRIDE; |
56 virtual void Reset() OVERRIDE; | 56 virtual void Reset() OVERRIDE; |
57 virtual void Destroy() OVERRIDE; | 57 virtual void Destroy() OVERRIDE; |
58 | 58 |
59 private: | 59 // Do any necessary initialization before the sandbox is enabled. |
| 60 static void PreSandboxInitialization(); |
| 61 |
| 62 private: |
60 // Ensure data has been synced with the output texture and notify | 63 // Ensure data has been synced with the output texture and notify |
61 // the client it is ready for displaying. | 64 // the client it is ready for displaying. |
62 void SyncAndNotifyPictureReady(int32 input_id, int32 output_id); | 65 void SyncAndNotifyPictureReady(int32 input_id, int32 output_id); |
63 | 66 |
64 // Notify the client that an error has occurred and decoding cannot continue. | 67 // Notify the client that an error has occurred and decoding cannot continue. |
65 void NotifyError(Error error); | 68 void NotifyError(Error error); |
66 | 69 |
67 // Map the received input buffer into this process' address space and | 70 // Map the received input buffer into this process' address space and |
68 // queue it for decode. | 71 // queue it for decode. |
69 void MapAndQueueNewInputBuffer( | 72 void MapAndQueueNewInputBuffer( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void ResetTask(); | 118 void ResetTask(); |
116 | 119 |
117 // Scheduled by ResetTask after it's done putting VAVDA into an idle state. | 120 // Scheduled by ResetTask after it's done putting VAVDA into an idle state. |
118 // Drops remaining input buffers and notifies the client that reset has been | 121 // Drops remaining input buffers and notifies the client that reset has been |
119 // finished. | 122 // finished. |
120 void FinishReset(); | 123 void FinishReset(); |
121 | 124 |
122 // Helper for Destroy(), doing all the actual work except for deleting self. | 125 // Helper for Destroy(), doing all the actual work except for deleting self. |
123 void Cleanup(); | 126 void Cleanup(); |
124 | 127 |
| 128 // Lazily initialize static data after sandbox is enabled. Return false on |
| 129 // init failure. |
| 130 static bool PostSandboxInitialization(); |
| 131 |
125 // Client-provided X/GLX state. | 132 // Client-provided X/GLX state. |
126 Display* x_display_; | 133 Display* x_display_; |
127 GLXContext glx_context_; | 134 GLXContext glx_context_; |
128 base::Callback<bool(void)> make_context_current_; | 135 base::Callback<bool(void)> make_context_current_; |
129 | 136 |
130 // VAVDA state. | 137 // VAVDA state. |
131 enum State { | 138 enum State { |
132 // Initialize() not called yet or failed. | 139 // Initialize() not called yet or failed. |
133 kUninitialized, | 140 kUninitialized, |
134 // Initialize() succeeded, no initial decode and no pictures requested. | 141 // Initialize() succeeded, no initial decode and no pictures requested. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 content::VaapiH264Decoder decoder_; | 204 content::VaapiH264Decoder decoder_; |
198 | 205 |
199 // Callback passed to the decoder, which it will use to signal readiness | 206 // Callback passed to the decoder, which it will use to signal readiness |
200 // of an output picture to be displayed. | 207 // of an output picture to be displayed. |
201 void OutputPicCallback(int32 input_id, int32 output_id); | 208 void OutputPicCallback(int32 input_id, int32 output_id); |
202 | 209 |
203 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 210 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
204 }; | 211 }; |
205 | 212 |
206 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 213 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |