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

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

Issue 3012853002: Update thread annotiation macros to use RTC_ prefix (Closed)
Patch Set: Rebase Created 3 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 | « webrtc/video/video_stream_decoder.h ('k') | webrtc/video/video_stream_encoder.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 /* 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 std::string ToString(const std::vector<int>& counters) const; 210 std::string ToString(const std::vector<int>& counters) const;
211 int Count(const std::vector<int>& counters) const; 211 int Count(const std::vector<int>& counters) const;
212 void MoveCount(std::vector<int>* counters, int from_reason); 212 void MoveCount(std::vector<int>* counters, int from_reason);
213 213
214 // Degradation counters holding number of framerate/resolution reductions 214 // Degradation counters holding number of framerate/resolution reductions
215 // per adapt reason. 215 // per adapt reason.
216 std::vector<int> fps_counters_; 216 std::vector<int> fps_counters_;
217 std::vector<int> resolution_counters_; 217 std::vector<int> resolution_counters_;
218 }; 218 };
219 219
220 AdaptCounter& GetAdaptCounter() RUN_ON(&encoder_queue_); 220 AdaptCounter& GetAdaptCounter() RTC_RUN_ON(&encoder_queue_);
221 const AdaptCounter& GetConstAdaptCounter() RUN_ON(&encoder_queue_); 221 const AdaptCounter& GetConstAdaptCounter() RTC_RUN_ON(&encoder_queue_);
222 void UpdateAdaptationStats(AdaptReason reason) RUN_ON(&encoder_queue_); 222 void UpdateAdaptationStats(AdaptReason reason) RTC_RUN_ON(&encoder_queue_);
223 AdaptCounts GetActiveCounts(AdaptReason reason) RUN_ON(&encoder_queue_); 223 AdaptCounts GetActiveCounts(AdaptReason reason) RTC_RUN_ON(&encoder_queue_);
224 224
225 rtc::Event shutdown_event_; 225 rtc::Event shutdown_event_;
226 226
227 const uint32_t number_of_cores_; 227 const uint32_t number_of_cores_;
228 // Counts how many frames we've dropped in the initial rampup phase. 228 // Counts how many frames we've dropped in the initial rampup phase.
229 int initial_rampup_; 229 int initial_rampup_;
230 230
231 const std::unique_ptr<VideoSourceProxy> source_proxy_; 231 const std::unique_ptr<VideoSourceProxy> source_proxy_;
232 EncoderSink* sink_; 232 EncoderSink* sink_;
233 const VideoSendStream::Config::EncoderSettings settings_; 233 const VideoSendStream::Config::EncoderSettings settings_;
234 const VideoCodecType codec_type_; 234 const VideoCodecType codec_type_;
235 235
236 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); 236 vcm::VideoSender video_sender_ RTC_ACCESS_ON(&encoder_queue_);
237 std::unique_ptr<OveruseFrameDetector> overuse_detector_ 237 std::unique_ptr<OveruseFrameDetector> overuse_detector_
238 ACCESS_ON(&encoder_queue_); 238 RTC_ACCESS_ON(&encoder_queue_);
239 std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_); 239 std::unique_ptr<QualityScaler> quality_scaler_ RTC_ACCESS_ON(&encoder_queue_);
240 240
241 SendStatisticsProxy* const stats_proxy_; 241 SendStatisticsProxy* const stats_proxy_;
242 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; 242 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
243 ProcessThread* module_process_thread_; 243 ProcessThread* module_process_thread_;
244 rtc::ThreadChecker module_process_thread_checker_; 244 rtc::ThreadChecker module_process_thread_checker_;
245 // |thread_checker_| checks that public methods that are related to lifetime 245 // |thread_checker_| checks that public methods that are related to lifetime
246 // of VideoStreamEncoder are called on the same thread. 246 // of VideoStreamEncoder are called on the same thread.
247 rtc::ThreadChecker thread_checker_; 247 rtc::ThreadChecker thread_checker_;
248 248
249 VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); 249 VideoEncoderConfig encoder_config_ RTC_ACCESS_ON(&encoder_queue_);
250 std::unique_ptr<VideoBitrateAllocator> rate_allocator_ 250 std::unique_ptr<VideoBitrateAllocator> rate_allocator_
251 ACCESS_ON(&encoder_queue_); 251 RTC_ACCESS_ON(&encoder_queue_);
252 // The maximum frame rate of the current codec configuration, as determined 252 // The maximum frame rate of the current codec configuration, as determined
253 // at the last ReconfigureEncoder() call. 253 // at the last ReconfigureEncoder() call.
254 int max_framerate_ ACCESS_ON(&encoder_queue_); 254 int max_framerate_ RTC_ACCESS_ON(&encoder_queue_);
255 255
256 // Set when ConfigureEncoder has been called in order to lazy reconfigure the 256 // Set when ConfigureEncoder has been called in order to lazy reconfigure the
257 // encoder on the next frame. 257 // encoder on the next frame.
258 bool pending_encoder_reconfiguration_ ACCESS_ON(&encoder_queue_); 258 bool pending_encoder_reconfiguration_ RTC_ACCESS_ON(&encoder_queue_);
259 rtc::Optional<VideoFrameInfo> last_frame_info_ ACCESS_ON(&encoder_queue_); 259 rtc::Optional<VideoFrameInfo> last_frame_info_ RTC_ACCESS_ON(&encoder_queue_);
260 int crop_width_ ACCESS_ON(&encoder_queue_); 260 int crop_width_ RTC_ACCESS_ON(&encoder_queue_);
261 int crop_height_ ACCESS_ON(&encoder_queue_); 261 int crop_height_ RTC_ACCESS_ON(&encoder_queue_);
262 uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); 262 uint32_t encoder_start_bitrate_bps_ RTC_ACCESS_ON(&encoder_queue_);
263 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); 263 size_t max_data_payload_length_ RTC_ACCESS_ON(&encoder_queue_);
264 bool nack_enabled_ ACCESS_ON(&encoder_queue_); 264 bool nack_enabled_ RTC_ACCESS_ON(&encoder_queue_);
265 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); 265 uint32_t last_observed_bitrate_bps_ RTC_ACCESS_ON(&encoder_queue_);
266 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); 266 bool encoder_paused_and_dropped_frame_ RTC_ACCESS_ON(&encoder_queue_);
267 Clock* const clock_; 267 Clock* const clock_;
268 // Counters used for deciding if the video resolution or framerate is 268 // Counters used for deciding if the video resolution or framerate is
269 // currently restricted, and if so, why, on a per degradation preference 269 // currently restricted, and if so, why, on a per degradation preference
270 // basis. 270 // basis.
271 // TODO(sprang): Replace this with a state holding a relative overuse measure 271 // TODO(sprang): Replace this with a state holding a relative overuse measure
272 // instead, that can be translated into suitable down-scale or fps limit. 272 // instead, that can be translated into suitable down-scale or fps limit.
273 std::map<const VideoSendStream::DegradationPreference, AdaptCounter> 273 std::map<const VideoSendStream::DegradationPreference, AdaptCounter>
274 adapt_counters_ ACCESS_ON(&encoder_queue_); 274 adapt_counters_ RTC_ACCESS_ON(&encoder_queue_);
275 // Set depending on degradation preferences. 275 // Set depending on degradation preferences.
276 VideoSendStream::DegradationPreference degradation_preference_ 276 VideoSendStream::DegradationPreference degradation_preference_
277 ACCESS_ON(&encoder_queue_); 277 RTC_ACCESS_ON(&encoder_queue_);
278 278
279 struct AdaptationRequest { 279 struct AdaptationRequest {
280 // The pixel count produced by the source at the time of the adaptation. 280 // The pixel count produced by the source at the time of the adaptation.
281 int input_pixel_count_; 281 int input_pixel_count_;
282 // Framerate received from the source at the time of the adaptation. 282 // Framerate received from the source at the time of the adaptation.
283 int framerate_fps_; 283 int framerate_fps_;
284 // Indicates if request was to adapt up or down. 284 // Indicates if request was to adapt up or down.
285 enum class Mode { kAdaptUp, kAdaptDown } mode_; 285 enum class Mode { kAdaptUp, kAdaptDown } mode_;
286 }; 286 };
287 // Stores a snapshot of the last adaptation request triggered by an AdaptUp 287 // Stores a snapshot of the last adaptation request triggered by an AdaptUp
288 // or AdaptDown signal. 288 // or AdaptDown signal.
289 rtc::Optional<AdaptationRequest> last_adaptation_request_ 289 rtc::Optional<AdaptationRequest> last_adaptation_request_
290 ACCESS_ON(&encoder_queue_); 290 RTC_ACCESS_ON(&encoder_queue_);
291 291
292 rtc::RaceChecker incoming_frame_race_checker_ 292 rtc::RaceChecker incoming_frame_race_checker_
293 GUARDED_BY(incoming_frame_race_checker_); 293 RTC_GUARDED_BY(incoming_frame_race_checker_);
294 Atomic32 posted_frames_waiting_for_encode_; 294 Atomic32 posted_frames_waiting_for_encode_;
295 // Used to make sure incoming time stamp is increasing for every frame. 295 // Used to make sure incoming time stamp is increasing for every frame.
296 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); 296 int64_t last_captured_timestamp_ RTC_GUARDED_BY(incoming_frame_race_checker_);
297 // Delta used for translating between NTP and internal timestamps. 297 // Delta used for translating between NTP and internal timestamps.
298 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); 298 const int64_t delta_ntp_internal_ms_
299 RTC_GUARDED_BY(incoming_frame_race_checker_);
299 300
300 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); 301 int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_);
301 int captured_frame_count_ ACCESS_ON(&encoder_queue_); 302 int captured_frame_count_ RTC_ACCESS_ON(&encoder_queue_);
302 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); 303 int dropped_frame_count_ RTC_ACCESS_ON(&encoder_queue_);
303 304
304 VideoBitrateAllocationObserver* bitrate_observer_ ACCESS_ON(&encoder_queue_); 305 VideoBitrateAllocationObserver* bitrate_observer_
305 rtc::Optional<int64_t> last_parameters_update_ms_ ACCESS_ON(&encoder_queue_); 306 RTC_ACCESS_ON(&encoder_queue_);
307 rtc::Optional<int64_t> last_parameters_update_ms_
308 RTC_ACCESS_ON(&encoder_queue_);
306 309
307 // All public methods are proxied to |encoder_queue_|. It must must be 310 // All public methods are proxied to |encoder_queue_|. It must must be
308 // destroyed first to make sure no tasks are run that use other members. 311 // destroyed first to make sure no tasks are run that use other members.
309 rtc::TaskQueue encoder_queue_; 312 rtc::TaskQueue encoder_queue_;
310 313
311 RTC_DISALLOW_COPY_AND_ASSIGN(VideoStreamEncoder); 314 RTC_DISALLOW_COPY_AND_ASSIGN(VideoStreamEncoder);
312 }; 315 };
313 316
314 } // namespace webrtc 317 } // namespace webrtc
315 318
316 #endif // WEBRTC_VIDEO_VIDEO_STREAM_ENCODER_H_ 319 #endif // WEBRTC_VIDEO_VIDEO_STREAM_ENCODER_H_
OLDNEW
« no previous file with comments | « webrtc/video/video_stream_decoder.h ('k') | webrtc/video/video_stream_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698