| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Until there are non-realtime users, no need for unrequested I-frames. | 60 // Until there are non-realtime users, no need for unrequested I-frames. |
| 61 IFRAME_INTERVAL = INT32_MAX, | 61 IFRAME_INTERVAL = INT32_MAX, |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // Impedance-mismatch fixers: MediaCodec is a poll-based API but VEA is a | 64 // Impedance-mismatch fixers: MediaCodec is a poll-based API but VEA is a |
| 65 // push-based API; these methods turn the crank to make the two work together. | 65 // push-based API; these methods turn the crank to make the two work together. |
| 66 void DoIOTask(); | 66 void DoIOTask(); |
| 67 void QueueInput(); | 67 void QueueInput(); |
| 68 void DequeueOutput(); | 68 void DequeueOutput(); |
| 69 | 69 |
| 70 // Returns true if we don't need more or bigger output buffers. | |
| 71 bool DoOutputBuffersSuffice(); | |
| 72 | |
| 73 // Start & stop |io_timer_| if the time seems right. | 70 // Start & stop |io_timer_| if the time seems right. |
| 74 void MaybeStartIOTimer(); | 71 void MaybeStartIOTimer(); |
| 75 void MaybeStopIOTimer(); | 72 void MaybeStopIOTimer(); |
| 76 | 73 |
| 77 // Used to DCHECK that we are called on the correct thread. | 74 // Used to DCHECK that we are called on the correct thread. |
| 78 base::ThreadChecker thread_checker_; | 75 base::ThreadChecker thread_checker_; |
| 79 | 76 |
| 80 // VideoDecodeAccelerator::Client callbacks go here. Invalidated once any | 77 // VideoDecodeAccelerator::Client callbacks go here. Invalidated once any |
| 81 // error triggers. | 78 // error triggers. |
| 82 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_; | 79 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 // Repeating timer responsible for draining pending IO to the codec. | 93 // Repeating timer responsible for draining pending IO to the codec. |
| 97 base::RepeatingTimer io_timer_; | 94 base::RepeatingTimer io_timer_; |
| 98 | 95 |
| 99 // The difference between number of buffers queued & dequeued at the codec. | 96 // The difference between number of buffers queued & dequeued at the codec. |
| 100 int32_t num_buffers_at_codec_; | 97 int32_t num_buffers_at_codec_; |
| 101 | 98 |
| 102 // A monotonically-growing value, used as a fake timestamp just to keep things | 99 // A monotonically-growing value, used as a fake timestamp just to keep things |
| 103 // appearing to move forward. | 100 // appearing to move forward. |
| 104 base::TimeDelta fake_input_timestamp_; | 101 base::TimeDelta fake_input_timestamp_; |
| 105 | 102 |
| 106 // Number of requested output buffers and their capacity. | 103 // Resolution of input stream. Set once in initialization and not allowed to |
| 107 int num_output_buffers_; // -1 until RequireBitstreamBuffers. | 104 // change after. |
| 108 size_t output_buffers_capacity_; // 0 until RequireBitstreamBuffers. | 105 gfx::Size frame_size_; |
| 109 | 106 |
| 110 uint32_t last_set_bitrate_; // In bps. | 107 uint32_t last_set_bitrate_; // In bps. |
| 111 | 108 |
| 112 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); | 109 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); |
| 113 }; | 110 }; |
| 114 | 111 |
| 115 } // namespace content | 112 } // namespace content |
| 116 | 113 |
| 117 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 114 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ |
| OLD | NEW |