Detach SequencedTaskChecker in MediaCodecVideoEncoder::Release.
If this is not done, the RTC_DCHECK_CALLED_SEQUENTIALLY might fire if the encoder is used on a new VideoStreamEncoder. This happens after VideoSendStream recreations due to changes in the SDP. BUG=b/66590444 Change-Id: I086370526afbbe2ba629805f97f89e512ba3f472 Reviewed-on: https://webrtc-review.googlesource.com/4360 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20020}
This commit is contained in:
committed by
Commit Bot
parent
c7b4a45594
commit
9cf9f758fc
@ -151,11 +151,11 @@ int SimulcastEncoderAdapter::Release() {
|
||||
while (!streaminfos_.empty()) {
|
||||
std::unique_ptr<VideoEncoder> encoder =
|
||||
std::move(streaminfos_.back().encoder);
|
||||
encoder->Release();
|
||||
// Even though it seems very unlikely, there are no guarantees that the
|
||||
// encoder will not call back after being Release()'d. Therefore, we disable
|
||||
// the callbacks here.
|
||||
// encoder will not call back after being Release()'d. Therefore, we first
|
||||
// disable the callbacks here.
|
||||
encoder->RegisterEncodeCompleteCallback(nullptr);
|
||||
encoder->Release();
|
||||
streaminfos_.pop_back(); // Deletes callback adapter.
|
||||
stored_encoders_.push(std::move(encoder));
|
||||
}
|
||||
|
||||
@ -1018,6 +1018,8 @@ int32_t MediaCodecVideoEncoder::Release() {
|
||||
}
|
||||
use_surface_ = false;
|
||||
ALOGD << "EncoderRelease done.";
|
||||
// It's legal to move the encoder to another queue now.
|
||||
encoder_queue_checker_.Detach();
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user