From e5d0fe0dff4f28735afe425b46e295b479c65dae Mon Sep 17 00:00:00 2001 From: philipel Date: Tue, 15 Oct 2019 11:02:53 +0200 Subject: [PATCH] Updated VideoStreamEncoder to destroy encoder_queue_ before encoder_switch_experiment_. Bug: none Change-Id: I0d72fd0b851bd3f9b5021bc9b51af5da882483dd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157044 Reviewed-by: Danil Chapovalov Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Philip Eliasson Cr-Commit-Position: refs/heads/master@{#29484} --- video/video_stream_encoder.cc | 6 +++--- video/video_stream_encoder.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index ead279425a..549a280407 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -525,11 +525,11 @@ VideoStreamEncoder::VideoStreamEncoder( frame_encode_metadata_writer_(this), experiment_groups_(GetExperimentGroups()), next_frame_id_(0), + encoder_switch_experiment_(ParseEncoderSwitchFieldTrial()), + encoder_switch_requested_(false), encoder_queue_(task_queue_factory->CreateTaskQueue( "EncoderQueue", - TaskQueueFactory::Priority::NORMAL)), - encoder_switch_experiment_(ParseEncoderSwitchFieldTrial()), - encoder_switch_requested_(false) { + TaskQueueFactory::Priority::NORMAL)) { RTC_DCHECK(encoder_stats_observer); RTC_DCHECK(overuse_detector_); RTC_DCHECK_GE(number_of_cores, 1); diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h index 309052f79a..3b096329fe 100644 --- a/video/video_stream_encoder.h +++ b/video/video_stream_encoder.h @@ -389,10 +389,6 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, std::array, kMaxSimulcastStreams> encoder_buffer_state_ RTC_GUARDED_BY(encoded_image_lock_); - // All public methods are proxied to |encoder_queue_|. It must must be - // destroyed first to make sure no tasks are run that use other members. - rtc::TaskQueue encoder_queue_; - struct EncoderSwitchExperiment { struct Thresholds { absl::optional bitrate; @@ -429,6 +425,10 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, // track of whether a request has been made or not. bool encoder_switch_requested_ RTC_GUARDED_BY(&encoder_queue_); + // All public methods are proxied to |encoder_queue_|. It must must be + // destroyed first to make sure no tasks are run that use other members. + rtc::TaskQueue encoder_queue_; + RTC_DISALLOW_COPY_AND_ASSIGN(VideoStreamEncoder); };