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 MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 bool force_keyframe) override; | 48 bool force_keyframe) override; |
49 void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) override; | 49 void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) override; |
50 void RequestEncodingParametersChange(uint32_t bitrate, | 50 void RequestEncodingParametersChange(uint32_t bitrate, |
51 uint32_t framerate) override; | 51 uint32_t framerate) override; |
52 void Destroy() override; | 52 void Destroy() override; |
53 | 53 |
54 private: | 54 private: |
55 enum { | 55 enum { |
56 // Arbitrary choice. | 56 // Arbitrary choice. |
57 INITIAL_FRAMERATE = 30, | 57 INITIAL_FRAMERATE = 30, |
58 // Until there are non-realtime users, no need for unrequested I-frames. | 58 // Default I-Frame interval in seconds. |
| 59 IFRAME_INTERVAL_H264 = 20, |
| 60 IFRAME_INTERVAL_VPX = 100, |
59 IFRAME_INTERVAL = INT32_MAX, | 61 IFRAME_INTERVAL = INT32_MAX, |
60 }; | 62 }; |
61 | 63 |
62 // 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 |
63 // 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. |
64 void DoIOTask(); | 66 void DoIOTask(); |
65 void QueueInput(); | 67 void QueueInput(); |
66 void DequeueOutput(); | 68 void DequeueOutput(); |
67 | 69 |
68 // Start & stop |io_timer_| if the time seems right. | 70 // Start & stop |io_timer_| if the time seems right. |
(...skipping 17 matching lines...) Expand all Loading... |
86 typedef std::queue<std::tuple<scoped_refptr<VideoFrame>, bool, base::Time>> | 88 typedef std::queue<std::tuple<scoped_refptr<VideoFrame>, bool, base::Time>> |
87 PendingFrames; | 89 PendingFrames; |
88 PendingFrames pending_frames_; | 90 PendingFrames pending_frames_; |
89 | 91 |
90 // Repeating timer responsible for draining pending IO to the codec. | 92 // Repeating timer responsible for draining pending IO to the codec. |
91 base::RepeatingTimer io_timer_; | 93 base::RepeatingTimer io_timer_; |
92 | 94 |
93 // The difference between number of buffers queued & dequeued at the codec. | 95 // The difference between number of buffers queued & dequeued at the codec. |
94 int32_t num_buffers_at_codec_; | 96 int32_t num_buffers_at_codec_; |
95 | 97 |
96 // A monotonically-growing value, used as a fake timestamp just to keep things | 98 // A monotonically-growing value. |
97 // appearing to move forward. | 99 base::TimeDelta input_timestamp_; |
98 base::TimeDelta fake_input_timestamp_; | |
99 | 100 |
100 // Resolution of input stream. Set once in initialization and not allowed to | 101 // Resolution of input stream. Set once in initialization and not allowed to |
101 // change after. | 102 // change after. |
102 gfx::Size frame_size_; | 103 gfx::Size frame_size_; |
103 | 104 |
104 uint32_t last_set_bitrate_; // In bps. | 105 uint32_t last_set_bitrate_; // In bps. |
105 | 106 |
106 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); | 107 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); |
107 }; | 108 }; |
108 | 109 |
109 } // namespace media | 110 } // namespace media |
110 | 111 |
111 #endif // MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 112 #endif // MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |