| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #ifndef VIDEO_VIDEO_STREAM_ENCODER_H_ |
| 12 | #define VIDEO_VIDEO_STREAM_ENCODER_H_ |
| 13 |
| 14 | #include <atomic> |
| 15 | #include <map> |
| 16 | #include <memory> |
| 17 | #include <string> |
| 18 | #include <vector> |
| 19 |
| 20 | #include "api/adaptation/resource.h" |
| 21 | #include "api/units/data_rate.h" |
| 22 | #include "api/video/video_bitrate_allocator.h" |
| 23 | #include "api/video/video_rotation.h" |
| 24 | #include "api/video/video_sink_interface.h" |
| 25 | #include "api/video/video_stream_encoder_interface.h" |
| 26 | #include "api/video/video_stream_encoder_observer.h" |
| 27 | #include "api/video/video_stream_encoder_settings.h" |
| 28 | #include "api/video_codecs/video_codec.h" |
| 29 | #include "api/video_codecs/video_encoder.h" |
| 30 | #include "call/adaptation/adaptation_constraint.h" |
| 31 | #include "call/adaptation/resource_adaptation_processor.h" |
| 32 | #include "call/adaptation/resource_adaptation_processor_interface.h" |
| 33 | #include "call/adaptation/video_source_restrictions.h" |
| 34 | #include "call/adaptation/video_stream_input_state_provider.h" |
| 35 | #include "modules/video_coding/utility/frame_dropper.h" |
| 36 | #include "rtc_base/event.h" |
| 37 | #include "rtc_base/experiments/rate_control_settings.h" |
| 38 | #include "rtc_base/numerics/exp_filter.h" |
| 39 | #include "rtc_base/race_checker.h" |
| 40 | #include "rtc_base/rate_statistics.h" |
| 41 | #include "rtc_base/synchronization/sequence_checker.h" |
| 42 | #include "rtc_base/task_queue.h" |
| 43 | #include "rtc_base/thread_checker.h" |
| 44 | #include "system_wrappers/include/clock.h" |
| 45 | #include "video/adaptation/video_stream_encoder_resource_manager.h" |
| 46 | #include "video/encoder_bitrate_adjuster.h" |
| 47 | #include "video/frame_encode_metadata_writer.h" |
| 48 | #include "video/video_source_sink_controller.h" |
| 49 |
| 50 | namespace webrtc { |
| 51 |
| 52 | // VideoStreamEncoder represent a video encoder that accepts raw video frames as |
| 53 | // input and produces an encoded bit stream. |
| 54 | // Usage: |
| 55 | // Instantiate. |
| 56 | // Call SetSink. |
| 57 | // Call SetSource. |
| 58 | // Call ConfigureEncoder with the codec settings. |
| 59 | // Call Stop() when done. |
| 60 | class VideoStreamEncoder : public VideoStreamEncoderInterface, |
| 61 | private EncodedImageCallback, |
| 62 | public VideoSourceRestrictionsListener { |
| 63 | public: |
| 64 | VideoStreamEncoder(Clock* clock, |
| 65 | uint32_t number_of_cores, |
| 66 | VideoStreamEncoderObserver* encoder_stats_observer, |
| 67 | const VideoStreamEncoderSettings& settings, |
| 68 | std::unique_ptr<OveruseFrameDetector> overuse_detector, |
| 69 | TaskQueueFactory* task_queue_factory); |
| 70 | ~VideoStreamEncoder() override; |
| 71 |
| 72 | void AddAdaptationResource(rtc::scoped_refptr<Resource> resource) override; |
| 73 | std::vector<rtc::scoped_refptr<Resource>> GetAdaptationResources() override; |
| 74 |
| 75 | void SetSource(rtc::VideoSourceInterface<VideoFrame>* source, |
| 76 | const DegradationPreference& degradation_preference) override; |
| 77 |
| 78 | void SetSink(EncoderSink* sink, bool rotation_applied) override; |
| 79 |
| 80 | // TODO(perkj): Can we remove VideoCodec.startBitrate ? |
| 81 | void SetStartBitrate(int start_bitrate_bps) override; |
| 82 |
| 83 | void SetBitrateAllocationObserver( |
| 84 | VideoBitrateAllocationObserver* bitrate_observer) override; |
| 85 |
| 86 | void SetFecControllerOverride( |
| 87 | FecControllerOverride* fec_controller_override) override; |
| 88 |
| 89 | void ConfigureEncoder(VideoEncoderConfig config, |
| 90 | size_t max_data_payload_length) override; |
| 91 |
| 92 | // Permanently stop encoding. After this method has returned, it is |
| 93 | // guaranteed that no encoded frames will be delivered to the sink. |
| 94 | void Stop() override; |
| 95 |
| 96 | void SendKeyFrame() override; |
| 97 |
| 98 | void OnLossNotification( |
| 99 | const VideoEncoder::LossNotification& loss_notification) override; |
| 100 |
| 101 | void OnBitrateUpdated(DataRate target_bitrate, |
| 102 | DataRate stable_target_bitrate, |
| 103 | DataRate target_headroom, |
| 104 | uint8_t fraction_lost, |
| 105 | int64_t round_trip_time_ms, |
| 106 | double cwnd_reduce_ratio) override; |
| 107 |
| 108 | DataRate UpdateTargetBitrate(DataRate target_bitrate, |
| 109 | double cwnd_reduce_ratio); |
| 110 |
| 111 | protected: |
| 112 | // Used for testing. For example the |ScalingObserverInterface| methods must |
| 113 | // be called on |encoder_queue_|. |
| 114 | rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } |
| 115 | rtc::TaskQueue* resource_adaptation_queue() { |
| 116 | return &resource_adaptation_queue_; |
| 117 | } |
| 118 |
| 119 | void OnVideoSourceRestrictionsUpdated( |
| 120 | VideoSourceRestrictions restrictions, |
| 121 | const VideoAdaptationCounters& adaptation_counters, |
| 122 | rtc::scoped_refptr<Resource> reason, |
| 123 | const VideoSourceRestrictions& unfiltered_restrictions) override; |
| 124 |
| 125 | // Used for injected test resources. |
| 126 | // TODO(eshr): Move all adaptation tests out of VideoStreamEncoder tests. |
| 127 | void InjectAdaptationResource(rtc::scoped_refptr<Resource> resource, |
| 128 | VideoAdaptationReason reason); |
| 129 | void InjectAdaptationConstraint(AdaptationConstraint* adaptation_constraint); |
| 130 |
| 131 | rtc::scoped_refptr<QualityScalerResource> |
| 132 | quality_scaler_resource_for_testing(); |
| 133 |
| 134 | void AddRestrictionsListenerForTesting( |
| 135 | VideoSourceRestrictionsListener* restrictions_listener); |
| 136 | void RemoveRestrictionsListenerForTesting( |
| 137 | VideoSourceRestrictionsListener* restrictions_listener); |
| 138 |
| 139 | private: |
| 140 | class VideoFrameInfo { |
| 141 | public: |
| 142 | VideoFrameInfo(int width, int height, bool is_texture) |
| 143 | : width(width), height(height), is_texture(is_texture) {} |
| 144 | int width; |
| 145 | int height; |
| 146 | bool is_texture; |
| 147 | int pixel_count() const { return width * height; } |
| 148 | }; |
| 149 |
| 150 | struct EncoderRateSettings { |
| 151 | EncoderRateSettings(); |
| 152 | EncoderRateSettings(const VideoBitrateAllocation& bitrate, |
| 153 | double framerate_fps, |
| 154 | DataRate bandwidth_allocation, |
| 155 | DataRate encoder_target, |
| 156 | DataRate stable_encoder_target); |
| 157 | bool operator==(const EncoderRateSettings& rhs) const; |
| 158 | bool operator!=(const EncoderRateSettings& rhs) const; |
| 159 |
| 160 | VideoEncoder::RateControlParameters rate_control; |
| 161 | // This is the scalar target bitrate before the VideoBitrateAllocator, i.e. |
| 162 | // the |target_bitrate| argument of the OnBitrateUpdated() method. This is |
| 163 | // needed because the bitrate allocator may truncate the total bitrate and a |
| 164 | // later call to the same allocator instance, e.g. |
| 165 | // |using last_encoder_rate_setings_->bitrate.get_sum_bps()|, may trick it |
| 166 | // into thinking the available bitrate has decreased since the last call. |
| 167 | DataRate encoder_target; |
| 168 | DataRate stable_encoder_target; |
| 169 | }; |
| 170 |
| 171 | class DegradationPreferenceManager; |
| 172 |
| 173 | void ReconfigureEncoder() RTC_RUN_ON(&encoder_queue_); |
| 174 | void OnEncoderSettingsChanged() RTC_RUN_ON(&encoder_queue_); |
| 175 |
| 176 | // Implements VideoSinkInterface. |
| 177 | void OnFrame(const VideoFrame& video_frame) override; |
| 178 | void OnDiscardedFrame() override; |
| 179 |
| 180 | void MaybeEncodeVideoFrame(const VideoFrame& frame, |
| 181 | int64_t time_when_posted_in_ms); |
| 182 |
| 183 | void EncodeVideoFrame(const VideoFrame& frame, |
| 184 | int64_t time_when_posted_in_ms); |
| 185 | // Indicates wether frame should be dropped because the pixel count is too |
| 186 | // large for the current bitrate configuration. |
| 187 | bool DropDueToSize(uint32_t pixel_count) const RTC_RUN_ON(&encoder_queue_); |
| 188 |
| 189 | // Implements EncodedImageCallback. |
| 190 | EncodedImageCallback::Result OnEncodedImage( |
| 191 | const EncodedImage& encoded_image, |
| 192 | const CodecSpecificInfo* codec_specific_info, |
| 193 | const RTPFragmentationHeader* fragmentation) override; |
| 194 |
| 195 | void OnDroppedFrame(EncodedImageCallback::DropReason reason) override; |
| 196 |
| 197 | bool EncoderPaused() const; |
| 198 | void TraceFrameDropStart(); |
| 199 | void TraceFrameDropEnd(); |
| 200 |
| 201 | // Returns a copy of |rate_settings| with the |bitrate| field updated using |
| 202 | // the current VideoBitrateAllocator, and notifies any listeners of the new |
| 203 | // allocation. |
| 204 | EncoderRateSettings UpdateBitrateAllocationAndNotifyObserver( |
| 205 | const EncoderRateSettings& rate_settings) RTC_RUN_ON(&encoder_queue_); |
| 206 |
| 207 | uint32_t GetInputFramerateFps() RTC_RUN_ON(&encoder_queue_); |
| 208 | void SetEncoderRates(const EncoderRateSettings& rate_settings) |
| 209 | RTC_RUN_ON(&encoder_queue_); |
| 210 |
| 211 | void RunPostEncode(const EncodedImage& encoded_image, |
| 212 | int64_t time_sent_us, |
| 213 | int temporal_index, |
| 214 | DataSize frame_size); |
| 215 | bool HasInternalSource() const RTC_RUN_ON(&encoder_queue_); |
| 216 | void ReleaseEncoder() RTC_RUN_ON(&encoder_queue_); |
| 217 |
| 218 | void CheckForAnimatedContent(const VideoFrame& frame, |
| 219 | int64_t time_when_posted_in_ms) |
| 220 | RTC_RUN_ON(&encoder_queue_); |
| 221 |
| 222 | rtc::Event shutdown_event_; |
| 223 |
| 224 | const uint32_t number_of_cores_; |
| 225 |
| 226 | const bool quality_scaling_experiment_enabled_; |
| 227 |
| 228 | EncoderSink* sink_; |
| 229 | const VideoStreamEncoderSettings settings_; |
| 230 | const RateControlSettings rate_control_settings_; |
| 231 |
| 232 | std::unique_ptr<VideoEncoderFactory::EncoderSelectorInterface> const |
| 233 | encoder_selector_; |
| 234 | VideoStreamEncoderObserver* const encoder_stats_observer_; |
| 235 | // |thread_checker_| checks that public methods that are related to lifetime |
| 236 | // of VideoStreamEncoder are called on the same thread. |
| 237 | rtc::ThreadChecker thread_checker_; |
| 238 |
| 239 | VideoEncoderConfig encoder_config_ RTC_GUARDED_BY(&encoder_queue_); |
| 240 | std::unique_ptr<VideoEncoder> encoder_ RTC_GUARDED_BY(&encoder_queue_) |
| 241 | RTC_PT_GUARDED_BY(&encoder_queue_); |
| 242 | bool encoder_initialized_; |
| 243 | std::unique_ptr<VideoBitrateAllocator> rate_allocator_ |
| 244 | RTC_GUARDED_BY(&encoder_queue_) RTC_PT_GUARDED_BY(&encoder_queue_); |
| 245 | int max_framerate_ RTC_GUARDED_BY(&encoder_queue_); |
| 246 |
| 247 | // Set when ConfigureEncoder has been called in order to lazy reconfigure the |
| 248 | // encoder on the next frame. |
| 249 | bool pending_encoder_reconfiguration_ RTC_GUARDED_BY(&encoder_queue_); |
| 250 | // Set when configuration must create a new encoder object, e.g., |
| 251 | // because of a codec change. |
| 252 | bool pending_encoder_creation_ RTC_GUARDED_BY(&encoder_queue_); |
| 253 |
| 254 | absl::optional<VideoFrameInfo> last_frame_info_ |
| 255 | RTC_GUARDED_BY(&encoder_queue_); |
| 256 | int crop_width_ RTC_GUARDED_BY(&encoder_queue_); |
| 257 | int crop_height_ RTC_GUARDED_BY(&encoder_queue_); |
| 258 | absl::optional<uint32_t> encoder_target_bitrate_bps_ |
| 259 | RTC_GUARDED_BY(&encoder_queue_); |
| 260 | size_t max_data_payload_length_ RTC_GUARDED_BY(&encoder_queue_); |
| 261 | absl::optional<EncoderRateSettings> last_encoder_rate_settings_ |
| 262 | RTC_GUARDED_BY(&encoder_queue_); |
| 263 | bool encoder_paused_and_dropped_frame_ RTC_GUARDED_BY(&encoder_queue_); |
| 264 |
| 265 | // Set to true if at least one frame was sent to encoder since last encoder |
| 266 | // initialization. |
| 267 | bool was_encode_called_since_last_initialization_ |
| 268 | RTC_GUARDED_BY(&encoder_queue_); |
| 269 |
| 270 | bool encoder_failed_ RTC_GUARDED_BY(&encoder_queue_); |
| 271 | Clock* const clock_; |
| 272 |
| 273 | rtc::RaceChecker incoming_frame_race_checker_ |
| 274 | RTC_GUARDED_BY(incoming_frame_race_checker_); |
| 275 | std::atomic<int> posted_frames_waiting_for_encode_; |
| 276 | // Used to make sure incoming time stamp is increasing for every frame. |
| 277 | int64_t last_captured_timestamp_ RTC_GUARDED_BY(incoming_frame_race_checker_); |
| 278 | // Delta used for translating between NTP and internal timestamps. |
| 279 | const int64_t delta_ntp_internal_ms_ |
| 280 | RTC_GUARDED_BY(incoming_frame_race_checker_); |
| 281 |
| 282 | int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_); |
| 283 | int captured_frame_count_ RTC_GUARDED_BY(&encoder_queue_); |
| 284 | int dropped_frame_cwnd_pushback_count_ RTC_GUARDED_BY(&encoder_queue_); |
| 285 | int dropped_frame_encoder_block_count_ RTC_GUARDED_BY(&encoder_queue_); |
| 286 | absl::optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_); |
| 287 | int64_t pending_frame_post_time_us_ RTC_GUARDED_BY(&encoder_queue_); |
| 288 |
| 289 | VideoFrame::UpdateRect accumulated_update_rect_ |
| 290 | RTC_GUARDED_BY(&encoder_queue_); |
| 291 | bool accumulated_update_rect_is_valid_ RTC_GUARDED_BY(&encoder_queue_); |
| 292 |
| 293 | // Used for automatic content type detection. |
| 294 | absl::optional<VideoFrame::UpdateRect> last_update_rect_ |
| 295 | RTC_GUARDED_BY(&encoder_queue_); |
| 296 | Timestamp animation_start_time_ RTC_GUARDED_BY(&encoder_queue_); |
| 297 | bool cap_resolution_due_to_video_content_ RTC_GUARDED_BY(&encoder_queue_); |
| 298 | // Used to correctly ignore changes in update_rect introduced by |
| 299 | // resize triggered by animation detection. |
| 300 | enum class ExpectResizeState { |
| 301 | kNoResize, // Normal operation. |
| 302 | kResize, // Resize was triggered by the animation detection. |
| 303 | kFirstFrameAfterResize // Resize observed. |
| 304 | } expect_resize_state_ RTC_GUARDED_BY(&encoder_queue_); |
| 305 |
| 306 | VideoBitrateAllocationObserver* bitrate_observer_ |
| 307 | RTC_GUARDED_BY(&encoder_queue_); |
| 308 | FecControllerOverride* fec_controller_override_ |
| 309 | RTC_GUARDED_BY(&encoder_queue_); |
| 310 | absl::optional<int64_t> last_parameters_update_ms_ |
| 311 | RTC_GUARDED_BY(&encoder_queue_); |
| 312 | absl::optional<int64_t> last_encode_info_ms_ RTC_GUARDED_BY(&encoder_queue_); |
| 313 |
| 314 | VideoEncoder::EncoderInfo encoder_info_ RTC_GUARDED_BY(&encoder_queue_); |
| 315 | absl::optional<VideoEncoder::ResolutionBitrateLimits> encoder_bitrate_limits_ |
| 316 | RTC_GUARDED_BY(&encoder_queue_); |
| 317 | VideoEncoderFactory::CodecInfo codec_info_ RTC_GUARDED_BY(&encoder_queue_); |
| 318 | VideoCodec send_codec_ RTC_GUARDED_BY(&encoder_queue_); |
| 319 |
| 320 | FrameDropper frame_dropper_ RTC_GUARDED_BY(&encoder_queue_); |
| 321 | // If frame dropper is not force disabled, frame dropping might still be |
| 322 | // disabled if VideoEncoder::GetEncoderInfo() indicates that the encoder has a |
| 323 | // trusted rate controller. This is determined on a per-frame basis, as the |
| 324 | // encoder behavior might dynamically change. |
| 325 | bool force_disable_frame_dropper_ RTC_GUARDED_BY(&encoder_queue_); |
| 326 | RateStatistics input_framerate_ RTC_GUARDED_BY(&encoder_queue_); |
| 327 | // Incremented on worker thread whenever |frame_dropper_| determines that a |
| 328 | // frame should be dropped. Decremented on whichever thread runs |
| 329 | // OnEncodedImage(), which is only called by one thread but not necessarily |
| 330 | // the worker thread. |
| 331 | std::atomic<int> pending_frame_drops_; |
| 332 |
| 333 | // Congestion window frame drop ratio (drop 1 in every |
| 334 | // cwnd_frame_drop_interval_ frames). |
| 335 | absl::optional<int> cwnd_frame_drop_interval_ RTC_GUARDED_BY(&encoder_queue_); |
| 336 | // Frame counter for congestion window frame drop. |
| 337 | int cwnd_frame_counter_ RTC_GUARDED_BY(&encoder_queue_); |
| 338 |
| 339 | std::unique_ptr<EncoderBitrateAdjuster> bitrate_adjuster_ |
| 340 | RTC_GUARDED_BY(&encoder_queue_); |
| 341 |
| 342 | // TODO(sprang): Change actually support keyframe per simulcast stream, or |
| 343 | // turn this into a simple bool |pending_keyframe_request_|. |
| 344 | std::vector<VideoFrameType> next_frame_types_ RTC_GUARDED_BY(&encoder_queue_); |
| 345 |
| 346 | FrameEncodeMetadataWriter frame_encode_metadata_writer_; |
| 347 |
| 348 | // Experiment groups parsed from field trials for realtime video ([0]) and |
| 349 | // screenshare ([1]). 0 means no group specified. Positive values are |
| 350 | // experiment group numbers incremented by 1. |
| 351 | const std::array<uint8_t, 2> experiment_groups_; |
| 352 |
| 353 | struct EncoderSwitchExperiment { |
| 354 | struct Thresholds { |
| 355 | absl::optional<DataRate> bitrate; |
| 356 | absl::optional<int> pixel_count; |
| 357 | }; |
| 358 |
| 359 | // Codec --> switching thresholds |
| 360 | std::map<VideoCodecType, Thresholds> codec_thresholds; |
| 361 |
| 362 | // To smooth out the target bitrate so that we don't trigger a switch |
| 363 | // too easily. |
| 364 | rtc::ExpFilter bitrate_filter{1.0}; |
| 365 |
| 366 | // Codec/implementation to switch to |
| 367 | std::string to_codec; |
| 368 | absl::optional<std::string> to_param; |
| 369 | absl::optional<std::string> to_value; |
| 370 |
| 371 | // Thresholds for the currently used codecs. |
| 372 | Thresholds current_thresholds; |
| 373 |
| 374 | // Updates the |bitrate_filter|, so not const. |
| 375 | bool IsBitrateBelowThreshold(const DataRate& target_bitrate); |
| 376 | bool IsPixelCountBelowThreshold(int pixel_count) const; |
| 377 | void SetCodec(VideoCodecType codec); |
| 378 | }; |
| 379 |
| 380 | EncoderSwitchExperiment ParseEncoderSwitchFieldTrial() const; |
| 381 |
| 382 | EncoderSwitchExperiment encoder_switch_experiment_ |
| 383 | RTC_GUARDED_BY(&encoder_queue_); |
| 384 |
| 385 | struct AutomaticAnimationDetectionExperiment { |
| 386 | bool enabled = false; |
| 387 | int min_duration_ms = 2000; |
| 388 | double min_area_ratio = 0.8; |
| 389 | int min_fps = 10; |
| 390 | std::unique_ptr<StructParametersParser> Parser() { |
| 391 | return StructParametersParser::Create( |
| 392 | "enabled", &enabled, // |
| 393 | "min_duration_ms", &min_duration_ms, // |
| 394 | "min_area_ratio", &min_area_ratio, // |
| 395 | "min_fps", &min_fps); |
| 396 | } |
| 397 | }; |
| 398 |
| 399 | AutomaticAnimationDetectionExperiment |
| 400 | ParseAutomatincAnimationDetectionFieldTrial() const; |
| 401 |
| 402 | AutomaticAnimationDetectionExperiment |
| 403 | automatic_animation_detection_experiment_ RTC_GUARDED_BY(&encoder_queue_); |
| 404 |
| 405 | // An encoder switch is only requested once, this variable is used to keep |
| 406 | // track of whether a request has been made or not. |
| 407 | bool encoder_switch_requested_ RTC_GUARDED_BY(&encoder_queue_); |
| 408 |
| 409 | // Provies video stream input states: current resolution and frame rate. |
| 410 | // This class is thread-safe. |
| 411 | VideoStreamInputStateProvider input_state_provider_; |
| 412 |
| 413 | std::unique_ptr<VideoStreamAdapter> video_stream_adapter_ |
| 414 | RTC_GUARDED_BY(&resource_adaptation_queue_); |
| 415 | // Responsible for adapting input resolution or frame rate to ensure resources |
| 416 | // (e.g. CPU or bandwidth) are not overused. |
| 417 | // Adding resources can occur on any thread, but all other methods need to be |
| 418 | // called on the adaptation thread. |
| 419 | std::unique_ptr<ResourceAdaptationProcessorInterface> |
| 420 | resource_adaptation_processor_; |
| 421 | std::unique_ptr<DegradationPreferenceManager> degradation_preference_manager_; |
| 422 | std::vector<AdaptationConstraint*> adaptation_constraints_ |
| 423 | RTC_GUARDED_BY(&resource_adaptation_queue_); |
| 424 | // Handles input, output and stats reporting related to VideoStreamEncoder |
| 425 | // specific resources, such as "encode usage percent" measurements and "QP |
| 426 | // scaling". Also involved with various mitigations such as inital frame |
| 427 | // dropping. |
| 428 | // The manager primarily operates on the |encoder_queue_| but its lifetime is |
| 429 | // tied to the VideoStreamEncoder (which is destroyed off the encoder queue) |
| 430 | // and its resource list is accessible from any thread. |
| 431 | VideoStreamEncoderResourceManager stream_resource_manager_; |
| 432 | // Carries out the VideoSourceRestrictions provided by the |
| 433 | // ResourceAdaptationProcessor, i.e. reconfigures the source of video frames |
| 434 | // to provide us with different resolution or frame rate. |
| 435 | // This class is thread-safe. |
| 436 | VideoSourceSinkController video_source_sink_controller_; |
| 437 |
| 438 | // Public methods are proxied to the task queues. The queues must be destroyed |
| 439 | // first to make sure no tasks run that use other members. |
| 440 | // TODO(https://crbug.com/webrtc/11172): Move ownership of the |
| 441 | // ResourceAdaptationProcessor and its task queue to Call when processors are |
| 442 | // multi-stream aware. |
| 443 | rtc::TaskQueue resource_adaptation_queue_; |
| 444 | rtc::TaskQueue encoder_queue_; |
| 445 |
| 446 | RTC_DISALLOW_COPY_AND_ASSIGN(VideoStreamEncoder); |
| 447 | }; |
| 448 |
| 449 | } // namespace webrtc |
| 450 |
| 451 | #endif // VIDEO_VIDEO_STREAM_ENCODER_H_ |
| 452 |