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

Side by Side Diff: webrtc/video/vie_encoder.h

Issue 2351633002: Let ViEEncoder handle resolution changes. (Closed)
Patch Set: fix line ending. 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 virtual void OnReceivedIntraFrameRequest(size_t stream_index); 91 virtual void OnReceivedIntraFrameRequest(size_t stream_index);
92 virtual void OnReceivedSLI(uint8_t picture_id); 92 virtual void OnReceivedSLI(uint8_t picture_id);
93 virtual void OnReceivedRPSI(uint64_t picture_id); 93 virtual void OnReceivedRPSI(uint64_t picture_id);
94 94
95 void OnBitrateUpdated(uint32_t bitrate_bps, 95 void OnBitrateUpdated(uint32_t bitrate_bps,
96 uint8_t fraction_lost, 96 uint8_t fraction_lost,
97 int64_t round_trip_time_ms); 97 int64_t round_trip_time_ms);
98 98
99 private: 99 private:
100 class EncodeTask; 100 class EncodeTask;
101 class ConfigureEncoderTask;
101 class VideoSourceProxy; 102 class VideoSourceProxy;
102 class ConfigureEncoderTask; 103
104 struct VideoFrameInfo {
105 VideoFrameInfo(int width,
106 int height,
107 VideoRotation rotation,
mflodman 2016/09/27 11:28:01 Should include webrtc/common_video/rotation.h.
perkj_webrtc 2016/09/27 13:45:17 Done.
108 bool is_texture)
109 : width(width),
110 height(height),
111 rotation(rotation),
112 is_texture(is_texture) {}
113 int width;
114 int height;
115 webrtc::VideoRotation rotation;
116 bool is_texture;
117 };
103 118
104 void ConfigureEncoderOnTaskQueue(VideoEncoderConfig config, 119 void ConfigureEncoderOnTaskQueue(VideoEncoderConfig config,
105 size_t max_data_payload_length); 120 size_t max_data_payload_length);
121 void ReconfigureEncoder();
106 122
107 // Implements VideoSinkInterface. 123 // Implements VideoSinkInterface.
108 void OnFrame(const VideoFrame& video_frame) override; 124 void OnFrame(const VideoFrame& video_frame) override;
109 125
110 // Implements VideoSendStatisticsCallback. 126 // Implements VideoSendStatisticsCallback.
111 void SendStatistics(uint32_t bit_rate, 127 void SendStatistics(uint32_t bit_rate,
112 uint32_t frame_rate) override; 128 uint32_t frame_rate) override;
113 129
114 void EncodeVideoFrame(const VideoFrame& frame, 130 void EncodeVideoFrame(const VideoFrame& frame,
115 int64_t time_when_posted_in_ms); 131 int64_t time_when_posted_in_ms);
(...skipping 14 matching lines...) Expand all
130 146
131 rtc::Event shutdown_event_; 147 rtc::Event shutdown_event_;
132 148
133 const uint32_t number_of_cores_; 149 const uint32_t number_of_cores_;
134 150
135 const std::unique_ptr<VideoSourceProxy> source_proxy_; 151 const std::unique_ptr<VideoSourceProxy> source_proxy_;
136 EncoderSink* sink_; 152 EncoderSink* sink_;
137 const VideoSendStream::Config::EncoderSettings settings_; 153 const VideoSendStream::Config::EncoderSettings settings_;
138 const VideoCodecType codec_type_; 154 const VideoCodecType codec_type_;
139 155
140 const std::unique_ptr<VideoProcessing> vp_;
141 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); 156 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_);
142 157
143 OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_); 158 OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_);
144 LoadObserver* const load_observer_ ACCESS_ON(&encoder_queue_); 159 LoadObserver* const load_observer_ ACCESS_ON(&encoder_queue_);
145 160
146 SendStatisticsProxy* const stats_proxy_; 161 SendStatisticsProxy* const stats_proxy_;
147 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; 162 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
148 ProcessThread* module_process_thread_; 163 ProcessThread* module_process_thread_;
149 rtc::ThreadChecker module_process_thread_checker_; 164 rtc::ThreadChecker module_process_thread_checker_;
150 // |thread_checker_| checks that public methods that are related to lifetime 165 // |thread_checker_| checks that public methods that are related to lifetime
151 // of ViEEncoder are called on the same thread. 166 // of ViEEncoder are called on the same thread.
152 rtc::ThreadChecker thread_checker_; 167 rtc::ThreadChecker thread_checker_;
153 168
154 VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); 169 VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_);
155 170
156 uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); 171 // Set when ConfigureEncoder has been called in order to lazy reconfigure the
172 // encoder on the next frame.
173 bool pending_encoder_reconfiguration_ ACCESS_ON(&encoder_queue_);
174 rtc::Optional<VideoFrameInfo> last_frame_info_ ACCESS_ON(&encoder_queue_);
175
176 unsigned int encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_);
mflodman 2016/09/27 11:28:01 uint32_t ?
perkj_webrtc 2016/09/27 13:45:17 Done.
157 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); 177 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_);
158 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); 178 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_);
159 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); 179 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_);
160 bool has_received_sli_ ACCESS_ON(&encoder_queue_); 180 bool has_received_sli_ ACCESS_ON(&encoder_queue_);
161 uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); 181 uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_);
162 bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); 182 bool has_received_rpsi_ ACCESS_ON(&encoder_queue_);
163 uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); 183 uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_);
164 Clock* const clock_; 184 Clock* const clock_;
165 185
166 rtc::RaceChecker incoming_frame_race_checker_; 186 rtc::RaceChecker incoming_frame_race_checker_;
(...skipping 10 matching lines...) Expand all
177 // All public methods are proxied to |encoder_queue_|. It must must be 197 // All public methods are proxied to |encoder_queue_|. It must must be
178 // destroyed first to make sure no tasks are run that use other members. 198 // destroyed first to make sure no tasks are run that use other members.
179 rtc::TaskQueue encoder_queue_; 199 rtc::TaskQueue encoder_queue_;
180 200
181 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); 201 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder);
182 }; 202 };
183 203
184 } // namespace webrtc 204 } // namespace webrtc
185 205
186 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ 206 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698