OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_GPU_VAAPI_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_VAAPI_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define MEDIA_GPU_VAAPI_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_VAAPI_VIDEO_ENCODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 scoped_refptr<VASurface> recon_surface; | 66 scoped_refptr<VASurface> recon_surface; |
67 // Buffer that will contain output bitstream for this frame. | 67 // Buffer that will contain output bitstream for this frame. |
68 VABufferID coded_buffer; | 68 VABufferID coded_buffer; |
69 // Reference surfaces required to encode this picture. We keep references | 69 // Reference surfaces required to encode this picture. We keep references |
70 // to them here, because we may discard some of them from ref_pic_list* | 70 // to them here, because we may discard some of them from ref_pic_list* |
71 // before the HW job is done. | 71 // before the HW job is done. |
72 RefPicList reference_surfaces; | 72 RefPicList reference_surfaces; |
73 // True if this job will produce a keyframe. Used to report | 73 // True if this job will produce a keyframe. Used to report |
74 // to BitstreamBufferReady(). | 74 // to BitstreamBufferReady(). |
75 bool keyframe; | 75 bool keyframe; |
| 76 // Source timestamp. |
| 77 base::TimeDelta timestamp; |
76 | 78 |
77 EncodeJob(); | 79 EncodeJob(); |
78 ~EncodeJob(); | 80 ~EncodeJob(); |
79 }; | 81 }; |
80 | 82 |
81 // Encoder state. | 83 // Encoder state. |
82 enum State { | 84 enum State { |
83 kUninitialized, | 85 kUninitialized, |
84 kEncoding, | 86 kEncoding, |
85 kError, | 87 kError, |
(...skipping 25 matching lines...) Expand all Loading... |
111 void UpdateRates(uint32_t bitrate, uint32_t framerate); | 113 void UpdateRates(uint32_t bitrate, uint32_t framerate); |
112 | 114 |
113 // Generate packed SPS and PPS in packed_sps_/packed_pps_, using | 115 // Generate packed SPS and PPS in packed_sps_/packed_pps_, using |
114 // values in current_sps_/current_pps_. | 116 // values in current_sps_/current_pps_. |
115 void GeneratePackedSPS(); | 117 void GeneratePackedSPS(); |
116 void GeneratePackedPPS(); | 118 void GeneratePackedPPS(); |
117 | 119 |
118 // Check if we have sufficient resources for a new encode job, claim them and | 120 // Check if we have sufficient resources for a new encode job, claim them and |
119 // fill current_encode_job_ with them. | 121 // fill current_encode_job_ with them. |
120 // Return false if we cannot start a new job yet, true otherwise. | 122 // Return false if we cannot start a new job yet, true otherwise. |
121 bool PrepareNextJob(); | 123 bool PrepareNextJob(base::TimeDelta timestamp); |
122 | 124 |
123 // Begin a new frame, making it a keyframe if |force_keyframe| is true, | 125 // Begin a new frame, making it a keyframe if |force_keyframe| is true, |
124 // updating current_pic_. | 126 // updating current_pic_. |
125 void BeginFrame(bool force_keyframe); | 127 void BeginFrame(bool force_keyframe); |
126 | 128 |
127 // End current frame, updating reference picture lists and storing current | 129 // End current frame, updating reference picture lists and storing current |
128 // job in the jobs awaiting completion on submitted_encode_jobs_. | 130 // job in the jobs awaiting completion on submitted_encode_jobs_. |
129 void EndFrame(); | 131 void EndFrame(); |
130 | 132 |
131 // Submit parameters for the current frame to the hardware. | 133 // Submit parameters for the current frame to the hardware. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // thread (it's a member of this class). | 260 // thread (it's a member of this class). |
259 base::WeakPtr<VaapiVideoEncodeAccelerator> weak_this_; | 261 base::WeakPtr<VaapiVideoEncodeAccelerator> weak_this_; |
260 base::WeakPtrFactory<VaapiVideoEncodeAccelerator> weak_this_ptr_factory_; | 262 base::WeakPtrFactory<VaapiVideoEncodeAccelerator> weak_this_ptr_factory_; |
261 | 263 |
262 DISALLOW_COPY_AND_ASSIGN(VaapiVideoEncodeAccelerator); | 264 DISALLOW_COPY_AND_ASSIGN(VaapiVideoEncodeAccelerator); |
263 }; | 265 }; |
264 | 266 |
265 } // namespace media | 267 } // namespace media |
266 | 268 |
267 #endif // MEDIA_GPU_VAAPI_VIDEO_ENCODE_ACCELERATOR_H_ | 269 #endif // MEDIA_GPU_VAAPI_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |