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 |
11 #include <list> | 11 #include <list> |
12 #include <memory> | 12 #include <memory> |
13 #include <queue> | 13 #include <queue> |
| 14 #include <tuple> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
19 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
20 #include "base/tuple.h" | |
21 #include "media/base/android/sdk_media_codec_bridge.h" | 21 #include "media/base/android/sdk_media_codec_bridge.h" |
22 #include "media/gpu/media_gpu_export.h" | 22 #include "media/gpu/media_gpu_export.h" |
23 #include "media/video/video_encode_accelerator.h" | 23 #include "media/video/video_encode_accelerator.h" |
24 | 24 |
25 namespace media { | 25 namespace media { |
26 class BitstreamBuffer; | 26 class BitstreamBuffer; |
27 } // namespace media | 27 } // namespace media |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 | 30 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 std::unique_ptr<base::WeakPtrFactory<Client>> client_ptr_factory_; | 80 std::unique_ptr<base::WeakPtrFactory<Client>> client_ptr_factory_; |
81 | 81 |
82 std::unique_ptr<media::VideoCodecBridge> media_codec_; | 82 std::unique_ptr<media::VideoCodecBridge> media_codec_; |
83 | 83 |
84 // Bitstream buffers waiting to be populated & returned to the client. | 84 // Bitstream buffers waiting to be populated & returned to the client. |
85 std::vector<media::BitstreamBuffer> available_bitstream_buffers_; | 85 std::vector<media::BitstreamBuffer> available_bitstream_buffers_; |
86 | 86 |
87 // Frames waiting to be passed to the codec, queued until an input buffer is | 87 // Frames waiting to be passed to the codec, queued until an input buffer is |
88 // available. Each element is a tuple of <Frame, key_frame, enqueue_time>. | 88 // available. Each element is a tuple of <Frame, key_frame, enqueue_time>. |
89 typedef std::queue< | 89 typedef std::queue< |
90 base::Tuple<scoped_refptr<media::VideoFrame>, bool, base::Time>> | 90 std::tuple<scoped_refptr<media::VideoFrame>, bool, base::Time>> |
91 PendingFrames; | 91 PendingFrames; |
92 PendingFrames pending_frames_; | 92 PendingFrames pending_frames_; |
93 | 93 |
94 // Repeating timer responsible for draining pending IO to the codec. | 94 // Repeating timer responsible for draining pending IO to the codec. |
95 base::RepeatingTimer io_timer_; | 95 base::RepeatingTimer io_timer_; |
96 | 96 |
97 // The difference between number of buffers queued & dequeued at the codec. | 97 // The difference between number of buffers queued & dequeued at the codec. |
98 int32_t num_buffers_at_codec_; | 98 int32_t num_buffers_at_codec_; |
99 | 99 |
100 // A monotonically-growing value, used as a fake timestamp just to keep things | 100 // A monotonically-growing value, used as a fake timestamp just to keep things |
101 // appearing to move forward. | 101 // appearing to move forward. |
102 base::TimeDelta fake_input_timestamp_; | 102 base::TimeDelta fake_input_timestamp_; |
103 | 103 |
104 // Resolution of input stream. Set once in initialization and not allowed to | 104 // Resolution of input stream. Set once in initialization and not allowed to |
105 // change after. | 105 // change after. |
106 gfx::Size frame_size_; | 106 gfx::Size frame_size_; |
107 | 107 |
108 uint32_t last_set_bitrate_; // In bps. | 108 uint32_t last_set_bitrate_; // In bps. |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); | 110 DISALLOW_COPY_AND_ASSIGN(AndroidVideoEncodeAccelerator); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace media | 113 } // namespace media |
114 | 114 |
115 #endif // MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ | 115 #endif // MEDIA_GPU_ANDROID_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |