Prevent potential UAF during VideoStreamEncoder teardown.

Bug: chromium:1357413
Change-Id: I9ec4d4fbafe1c25530346faf09f5b437fad718cc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273482
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Erik Språng <sprang@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37948}
This commit is contained in:
Erik Språng 2022-08-30 12:02:14 +02:00 committed by WebRTC LUCI CQ
parent fbb7ce8a93
commit 1cb799c31c

View file

@ -450,12 +450,15 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
const absl::optional<int> vp9_low_tier_core_threshold_;
// Used to cancel any potentially pending tasks to the worker thread.
// Refrenced by tasks running on `encoder_queue_` so need to be destroyed
// after stopping that queue. Must be created and destroyed on
// `worker_queue_`.
ScopedTaskSafety task_safety_;
// Public methods are proxied to the task queues. The queues must be destroyed
// first to make sure no tasks run that use other members.
rtc::TaskQueue encoder_queue_;
// Used to cancel any potentially pending tasks to the worker thread.
ScopedTaskSafety task_safety_;
};
} // namespace webrtc