OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // to NO_ERROR or ERROR depending on success. | 87 // to NO_ERROR or ERROR depending on success. |
88 WAITING_FOR_CODEC, | 88 WAITING_FOR_CODEC, |
89 // Set when we have a codec, but it doesn't yet have a key. | 89 // Set when we have a codec, but it doesn't yet have a key. |
90 WAITING_FOR_KEY, | 90 WAITING_FOR_KEY, |
91 // The output surface was destroyed. We must not configure a new MediaCodec | 91 // The output surface was destroyed. We must not configure a new MediaCodec |
92 // with the destroyed surface. | 92 // with the destroyed surface. |
93 SURFACE_DESTROYED, | 93 SURFACE_DESTROYED, |
94 }; | 94 }; |
95 | 95 |
96 enum DrainType { | 96 enum DrainType { |
97 DRAIN_TYPE_NONE, | |
98 DRAIN_FOR_FLUSH, | 97 DRAIN_FOR_FLUSH, |
99 DRAIN_FOR_RESET, | 98 DRAIN_FOR_RESET, |
100 DRAIN_FOR_DESTROY, | 99 DRAIN_FOR_DESTROY, |
101 }; | 100 }; |
102 | 101 |
103 // Initialize of the picture buffer manager. This is to be called when the | 102 // Initialize of the picture buffer manager. This is to be called when the |
104 // SurfaceView in |surface_id_|, if any, is no longer busy. It will return | 103 // SurfaceView in |surface_id_|, if any, is no longer busy. It will return |
105 // false on failure, and true if initialization was successful. This includes | 104 // false on failure, and true if initialization was successful. This includes |
106 // synchronous and asynchronous init; the AVDA might not yet have a codec on | 105 // synchronous and asynchronous init; the AVDA might not yet have a codec on |
107 // success, but async init will at least be in progress. | 106 // success, but async init will at least be in progress. |
(...skipping 23 matching lines...) Expand all Loading... |
131 | 130 |
132 // Sends the decoded frame specified by |codec_buffer_index| to the client. | 131 // Sends the decoded frame specified by |codec_buffer_index| to the client. |
133 void SendDecodedFrameToClient(int32_t codec_buffer_index, | 132 void SendDecodedFrameToClient(int32_t codec_buffer_index, |
134 int32_t bitstream_id); | 133 int32_t bitstream_id); |
135 | 134 |
136 // Does pending IO tasks if any. Once this is called, it polls |media_codec_| | 135 // Does pending IO tasks if any. Once this is called, it polls |media_codec_| |
137 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is | 136 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is |
138 // used. | 137 // used. |
139 void DoIOTask(bool start_timer); | 138 void DoIOTask(bool start_timer); |
140 | 139 |
141 // Feeds input data to |media_codec_|. This checks | 140 // Feeds buffers in |pending_bitstream_records_| to |media_codec_|. Returns |
142 // |pending_bitstream_buffers_| and queues a buffer to |media_codec_|. | 141 // true if one was queued. |
143 // Returns true if any input was processed. | |
144 bool QueueInput(); | 142 bool QueueInput(); |
145 | 143 |
146 // Dequeues output from |media_codec_| and feeds the decoded frame to the | 144 // Dequeues output from |media_codec_| and feeds the decoded frame to the |
147 // client. Returns a hint about whether calling again might produce | 145 // client. Returns a hint about whether calling again might produce |
148 // more output. | 146 // more output. |
149 bool DequeueOutput(); | 147 bool DequeueOutput(); |
150 | 148 |
151 // Requests picture buffers from the client. | 149 // Requests picture buffers from the client. |
152 void RequestPictureBuffers(); | 150 void RequestPictureBuffers(); |
153 | 151 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 273 |
276 // Keeps track of bitstream ids notified to the client with | 274 // Keeps track of bitstream ids notified to the client with |
277 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. | 275 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. |
278 std::list<int32_t> bitstreams_notified_in_advance_; | 276 std::list<int32_t> bitstreams_notified_in_advance_; |
279 | 277 |
280 AVDAPictureBufferManager picture_buffer_manager_; | 278 AVDAPictureBufferManager picture_buffer_manager_; |
281 | 279 |
282 // Time at which we last did useful work on io_timer_. | 280 // Time at which we last did useful work on io_timer_. |
283 base::TimeTicks most_recent_work_; | 281 base::TimeTicks most_recent_work_; |
284 | 282 |
285 // Type of a drain request. We need to distinguish between DRAIN_FOR_FLUSH | 283 // The ongoing drain operation, if any. |
286 // and other types, see IsDrainingForResetOrDestroy(). | 284 base::Optional<DrainType> drain_type_; |
287 DrainType drain_type_; | |
288 | 285 |
289 // Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. | 286 // Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. |
290 scoped_refptr<MediaKeys> cdm_for_reference_holding_only_; | 287 scoped_refptr<MediaKeys> cdm_for_reference_holding_only_; |
291 | 288 |
292 MediaDrmBridgeCdmContext* media_drm_bridge_cdm_context_; | 289 MediaDrmBridgeCdmContext* media_drm_bridge_cdm_context_; |
293 | 290 |
294 // MediaDrmBridge requires registration/unregistration of the player, this | 291 // MediaDrmBridge requires registration/unregistration of the player, this |
295 // registration id is used for this. | 292 // registration id is used for this. |
296 int cdm_registration_id_; | 293 int cdm_registration_id_; |
297 | 294 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 327 |
331 // WeakPtrFactory for posting tasks back to |this|. | 328 // WeakPtrFactory for posting tasks back to |this|. |
332 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 329 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
333 | 330 |
334 friend class AndroidVideoDecodeAcceleratorTest; | 331 friend class AndroidVideoDecodeAcceleratorTest; |
335 }; | 332 }; |
336 | 333 |
337 } // namespace media | 334 } // namespace media |
338 | 335 |
339 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 336 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |