Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: media/gpu/android_video_encode_accelerator.h

Issue 2358683002: Android: enable/disable WebRTC HW H264 with a flag. (Closed)
Patch Set: loop codecs in fineHWEncoder() and other fixes. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void Encode(const scoped_refptr<VideoFrame>& frame, 47 void Encode(const scoped_refptr<VideoFrame>& frame,
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,
watk 2016/10/01 01:06:54 Should this just be called FRAMERATE? Not sure why
braveyao 2016/10/03 23:50:15 Because this value is for initializing encoder onl
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
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 in us.
watk 2016/10/01 01:06:54 delete "in us". TimeDelta knows its units.
braveyao 2016/10/03 23:50:15 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698