SimulcastEncoderAdapter: Add sequence checks for encoder contexts lifetime
This CL adds the sequence checks to the functions that creates or destroys the encoder context. Those functions must be executed on the webrtc encoder sequence. Bug: b/320555128 Change-Id: I1daa93f2f5326073e8d75e1d711d7554bed76a62 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356460 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Hirokazu Honda <hiroh@google.com> Cr-Commit-Position: refs/heads/main@{#42612}
This commit is contained in:
parent
06af5b5c64
commit
44a7550acc
@ -277,6 +277,7 @@ SimulcastEncoderAdapter::SimulcastEncoderAdapter(
|
||||
}
|
||||
|
||||
SimulcastEncoderAdapter::~SimulcastEncoderAdapter() {
|
||||
RTC_DCHECK_RUN_ON(&encoder_queue_);
|
||||
RTC_DCHECK(!Initialized());
|
||||
DestroyStoredEncoders();
|
||||
}
|
||||
@ -714,6 +715,7 @@ bool SimulcastEncoderAdapter::Initialized() const {
|
||||
}
|
||||
|
||||
void SimulcastEncoderAdapter::DestroyStoredEncoders() {
|
||||
RTC_DCHECK_RUN_ON(&encoder_queue_);
|
||||
while (!cached_encoder_contexts_.empty()) {
|
||||
cached_encoder_contexts_.pop_back();
|
||||
}
|
||||
@ -722,6 +724,7 @@ void SimulcastEncoderAdapter::DestroyStoredEncoders() {
|
||||
std::unique_ptr<SimulcastEncoderAdapter::EncoderContext>
|
||||
SimulcastEncoderAdapter::FetchOrCreateEncoderContext(
|
||||
bool is_lowest_quality_stream) const {
|
||||
RTC_DCHECK_RUN_ON(&encoder_queue_);
|
||||
bool prefer_temporal_support = fallback_encoder_factory_ != nullptr &&
|
||||
is_lowest_quality_stream &&
|
||||
prefer_temporal_support_on_base_layer_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user