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

Side by Side Diff: remoting/codec/webrtc_video_encoder_vpx.h

Issue 2335923002: Add WebrtcCaptureScheduler interface. (Closed)
Patch Set: include <algorithm> Created 4 years, 3 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
« no previous file with comments | « remoting/codec/webrtc_video_encoder.h ('k') | remoting/codec/webrtc_video_encoder_vpx.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_ 5 #ifndef REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_
6 #define REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_ 6 #define REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 std::unique_ptr<EncodedFrame> Encode(const webrtc::DesktopFrame& frame, 44 std::unique_ptr<EncodedFrame> Encode(const webrtc::DesktopFrame& frame,
45 const FrameParams& params) override; 45 const FrameParams& params) override;
46 46
47 private: 47 private:
48 explicit WebrtcVideoEncoderVpx(bool use_vp9); 48 explicit WebrtcVideoEncoderVpx(bool use_vp9);
49 49
50 // (Re)Configures this instance to encode frames of the specified |size|, 50 // (Re)Configures this instance to encode frames of the specified |size|,
51 // with the configured lossless color & encoding modes. 51 // with the configured lossless color & encoding modes.
52 void Configure(const webrtc::DesktopSize& size); 52 void Configure(const webrtc::DesktopSize& size);
53 53
54 // Updates target bitrate. 54 // Updates codec configuration.
55 void UpdateTargetBitrate(int new_bitrate_kbps); 55 void UpdateConfig(const FrameParams& params);
56 56
57 // Prepares |image_| for encoding. Writes updated rectangles into 57 // Prepares |image_| for encoding. Writes updated rectangles into
58 // |updated_region|. 58 // |updated_region|.
59 void PrepareImage(const webrtc::DesktopFrame& frame, 59 void PrepareImage(const webrtc::DesktopFrame& frame,
60 webrtc::DesktopRegion* updated_region); 60 webrtc::DesktopRegion* updated_region);
61 61
62 // Clears active map.
63 void ClearActiveMap();
64
62 // Updates the active map according to |updated_region|. Active map is then 65 // Updates the active map according to |updated_region|. Active map is then
63 // given to the encoder to speed up encoding. 66 // given to the encoder to speed up encoding.
64 void SetActiveMapFromRegion(const webrtc::DesktopRegion& updated_region); 67 void SetActiveMapFromRegion(const webrtc::DesktopRegion& updated_region);
65 68
66 // Adds areas changed in the most recent frame to |updated_region|. This 69 // Adds areas changed in the most recent frame to |updated_region|. This
67 // includes both content changes and areas enhanced by cyclic refresh. 70 // includes both content changes and areas enhanced by cyclic refresh.
68 void UpdateRegionFromActiveMap(webrtc::DesktopRegion* updated_region); 71 void UpdateRegionFromActiveMap(webrtc::DesktopRegion* updated_region);
69 72
70 // True if the encoder is for VP9, false for VP8. 73 // True if the encoder is for VP9, false for VP8.
71 const bool use_vp9_; 74 const bool use_vp9_;
72 75
73 // Options controlling VP9 encode quantization and color space. 76 // Options controlling VP9 encode quantization and color space.
74 // These are always off (false) for VP8. 77 // These are always off (false) for VP8.
75 bool lossless_encode_ = false; 78 bool lossless_encode_ = false;
76 bool lossless_color_ = false; 79 bool lossless_color_ = false;
77 80
78 // Holds the initialized & configured codec. 81 // Holds the initialized & configured codec.
79 ScopedVpxCodec codec_; 82 ScopedVpxCodec codec_;
80 83
81 vpx_codec_enc_cfg_t config_; 84 vpx_codec_enc_cfg_t config_;
82 uint32_t target_bitrate_kbps_;
83 85
84 // Used to generate zero-based frame timestamps. 86 // Used to generate zero-based frame timestamps.
85 base::TimeTicks timestamp_base_; 87 base::TimeTicks timestamp_base_;
86 88
87 // VPX image and buffer to hold the actual YUV planes. 89 // VPX image and buffer to hold the actual YUV planes.
88 std::unique_ptr<vpx_image_t> image_; 90 std::unique_ptr<vpx_image_t> image_;
89 std::unique_ptr<uint8_t[]> image_buffer_; 91 std::unique_ptr<uint8_t[]> image_buffer_;
90 92
91 // Active map used to optimize out processing of un-changed macroblocks. 93 // Active map used to optimize out processing of un-changed macroblocks.
92 std::unique_ptr<uint8_t[]> active_map_; 94 std::unique_ptr<uint8_t[]> active_map_;
93 webrtc::DesktopSize active_map_size_; 95 webrtc::DesktopSize active_map_size_;
94 96
95 // True if the codec wants unchanged frames to finish topping-off with.
96 bool encode_unchanged_frame_;
97
98 base::DefaultTickClock default_tick_clock_; 97 base::DefaultTickClock default_tick_clock_;
99 base::TickClock* clock_; 98 base::TickClock* clock_;
100 99
101 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoEncoderVpx); 100 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoEncoderVpx);
102 }; 101 };
103 102
104 } // namespace remoting 103 } // namespace remoting
105 104
106 #endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_ 105 #endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_
OLDNEW
« no previous file with comments | « remoting/codec/webrtc_video_encoder.h ('k') | remoting/codec/webrtc_video_encoder_vpx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698