Switch to use SequencedTaskChecker instead of ThreadChecker where needed.
This cl is in preparation for https://codereview.webrtc.org/2060403002/ Add task queue to Call.
In the coming cl the video_sender, and i420_buffer_pool will be used on a task queue and therefore SequencedTaskChecker is needed instead of a ThreadChecker.
BUG=webrtc:5687
Review-Url: https://codereview.webrtc.org/2149553002
Cr-Commit-Position: refs/heads/master@{#13474}
diff --git a/webrtc/modules/video_coding/video_coding.gypi b/webrtc/modules/video_coding/video_coding.gypi
index 602f368..0b682c7 100644
--- a/webrtc/modules/video_coding/video_coding.gypi
+++ b/webrtc/modules/video_coding/video_coding.gypi
@@ -14,6 +14,7 @@
'dependencies': [
'webrtc_h264',
'webrtc_i420',
+ '../base/base.gyp:rtc_task_queue',
'<(webrtc_root)/common_video/common_video.gyp:common_video',
'<(webrtc_root)/modules/video_coding/utility/video_coding_utility.gyp:video_coding_utility',
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
diff --git a/webrtc/modules/video_coding/video_coding_impl.h b/webrtc/modules/video_coding/video_coding_impl.h
index 6bafd5a..40bccf2 100644
--- a/webrtc/modules/video_coding/video_coding_impl.h
+++ b/webrtc/modules/video_coding/video_coding_impl.h
@@ -19,7 +19,7 @@
#include "webrtc/base/onetimeevent.h"
#include "webrtc/base/thread_annotations.h"
-#include "webrtc/base/thread_checker.h"
+#include "webrtc/base/sequenced_task_checker.h"
#include "webrtc/common_video/include/frame_callback.h"
#include "webrtc/modules/video_coding/codec_database.h"
#include "webrtc/modules/video_coding/frame_buffer.h"
@@ -108,8 +108,7 @@
// Must be accessed on the construction thread of VideoSender.
VideoCodec current_codec_;
- rtc::ThreadChecker main_thread_;
-
+ rtc::SequencedTaskChecker sequenced_checker_;
rtc::CriticalSection params_crit_;
EncoderParameters encoder_params_ GUARDED_BY(params_crit_);
diff --git a/webrtc/modules/video_coding/video_sender.cc b/webrtc/modules/video_coding/video_sender.cc
index aecc60c..f3e2bfe 100644
--- a/webrtc/modules/video_coding/video_sender.cc
+++ b/webrtc/modules/video_coding/video_sender.cc
@@ -43,7 +43,7 @@
// Allow VideoSender to be created on one thread but used on another, post
// construction. This is currently how this class is being used by at least
// one external project (diffractor).
- main_thread_.DetachFromThread();
+ sequenced_checker_.Detach();
}
VideoSender::~VideoSender() {}
@@ -82,7 +82,7 @@
int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec,
uint32_t numberOfCores,
uint32_t maxPayloadSize) {
- RTC_DCHECK(main_thread_.CalledOnValidThread());
+ RTC_DCHECK(sequenced_checker_.CalledSequentially());
rtc::CritScope lock(&encoder_crit_);
if (sendCodec == nullptr) {
return VCM_PARAMETER_ERROR;
@@ -150,7 +150,7 @@
void VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder,
uint8_t payloadType,
bool internalSource /*= false*/) {
- RTC_DCHECK(main_thread_.CalledOnValidThread());
+ RTC_DCHECK(sequenced_checker_.CalledSequentially());
rtc::CritScope lock(&encoder_crit_);
@@ -172,7 +172,7 @@
// Get encode bitrate
int VideoSender::Bitrate(unsigned int* bitrate) const {
- RTC_DCHECK(main_thread_.CalledOnValidThread());
+ RTC_DCHECK(sequenced_checker_.CalledSequentially());
// Since we're running on the thread that's the only thread known to modify
// the value of _encoder, we don't need to grab the lock here.
@@ -184,7 +184,7 @@
// Get encode frame rate
int VideoSender::FrameRate(unsigned int* framerate) const {
- RTC_DCHECK(main_thread_.CalledOnValidThread());
+ RTC_DCHECK(sequenced_checker_.CalledSequentially());
// Since we're running on the thread that's the only thread known to modify
// the value of _encoder, we don't need to grab the lock here.