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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void ResetTask(); | 117 void ResetTask(); |
115 | 118 |
116 // Scheduled by ResetTask after it's done putting VAVDA into an idle state. | 119 // Scheduled by ResetTask after it's done putting VAVDA into an idle state. |
117 // Drops remaining input buffers and notifies the client that reset has been | 120 // Drops remaining input buffers and notifies the client that reset has been |
118 // finished. | 121 // finished. |
119 void FinishReset(); | 122 void FinishReset(); |
120 | 123 |
121 // Helper for Destroy(), doing all the actual work except for deleting self. | 124 // Helper for Destroy(), doing all the actual work except for deleting self. |
122 void Cleanup(); | 125 void Cleanup(); |
123 | 126 |
| 127 // Lazily initialize static data after sandbox is enabled. Return false on |
| 128 // init failure. |
| 129 static bool PostSandboxInitialization(); |
| 130 |
124 // Client-provided X/GLX state. | 131 // Client-provided X/GLX state. |
125 Display* x_display_; | 132 Display* x_display_; |
126 GLXContext glx_context_; | 133 GLXContext glx_context_; |
127 base::Callback<bool(void)> make_context_current_; | 134 base::Callback<bool(void)> make_context_current_; |
128 | 135 |
129 // VAVDA state. | 136 // VAVDA state. |
130 enum State { | 137 enum State { |
131 // Initialize() not called yet or failed. | 138 // Initialize() not called yet or failed. |
132 kUninitialized, | 139 kUninitialized, |
133 // Initialize() succeeded, no initial decode and no pictures requested. | 140 // Initialize() succeeded, no initial decode and no pictures requested. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 content::VaapiH264Decoder decoder_; | 203 content::VaapiH264Decoder decoder_; |
197 | 204 |
198 // Callback passed to the decoder, which it will use to signal readiness | 205 // Callback passed to the decoder, which it will use to signal readiness |
199 // of an output picture to be displayed. | 206 // of an output picture to be displayed. |
200 void OutputPicCallback(int32 input_id, int32 output_id); | 207 void OutputPicCallback(int32 input_id, int32 output_id); |
201 | 208 |
202 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 209 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
203 }; | 210 }; |
204 | 211 |
205 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 212 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |