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 <danilchap@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29484}
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index ead2794..549a280 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -525,11 +525,11 @@
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 309052f..3b09632 100644
--- a/video/video_stream_encoder.h
+++ b/video/video_stream_encoder.h
@@ -389,10 +389,6 @@
std::array<std::array<int64_t, kMaxEncoderBuffers>, 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<DataRate> bitrate;
@@ -429,6 +425,10 @@
// 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);
};