Index: webrtc/video/vie_encoder.cc |
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc |
index e85a05fd42feb5f8e31dca8b2097241648998689..d9abb1e0a2decfb866468210382caf9d38d7c2d5 100644 |
--- a/webrtc/video/vie_encoder.cc |
+++ b/webrtc/video/vie_encoder.cc |
@@ -28,7 +28,6 @@ |
namespace webrtc { |
ViEEncoder::ViEEncoder(uint32_t number_of_cores, |
- ProcessThread* module_process_thread, |
SendStatisticsProxy* stats_proxy, |
OveruseFrameDetector* overuse_detector, |
EncodedImageCallback* sink) |
@@ -38,17 +37,15 @@ ViEEncoder::ViEEncoder(uint32_t number_of_cores, |
video_sender_(Clock::GetRealTimeClock(), this, this, this), |
stats_proxy_(stats_proxy), |
overuse_detector_(overuse_detector), |
- time_of_last_frame_activity_ms_(std::numeric_limits<int64_t>::max()), |
encoder_config_(), |
last_observed_bitrate_bps_(0), |
encoder_paused_and_dropped_frame_(false), |
- module_process_thread_(module_process_thread), |
+ module_process_thread_(nullptr), |
has_received_sli_(false), |
picture_id_sli_(0), |
has_received_rpsi_(false), |
picture_id_rpsi_(0), |
video_suspended_(false) { |
- module_process_thread_->RegisterModule(&video_sender_); |
vp_->EnableTemporalDecimation(true); |
} |
@@ -56,7 +53,14 @@ vcm::VideoSender* ViEEncoder::video_sender() { |
return &video_sender_; |
} |
-ViEEncoder::~ViEEncoder() { |
+ViEEncoder::~ViEEncoder() {} |
+ |
+void ViEEncoder::RegisterProcessThread(ProcessThread* module_process_thread) { |
+ RTC_DCHECK(!module_process_thread_); |
+ module_process_thread_ = module_process_thread; |
+ module_process_thread_->RegisterModule(&video_sender_); |
+} |
+void ViEEncoder::DeRegisterProcessThread() { |
module_process_thread_->DeRegisterModule(&video_sender_); |
} |
@@ -139,7 +143,6 @@ void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame) { |
VideoCodecType codec_type; |
{ |
rtc::CritScope lock(&data_cs_); |
- time_of_last_frame_activity_ms_ = rtc::TimeMillis(); |
if (EncoderPaused()) { |
TraceFrameDropStart(); |
return; |
@@ -188,11 +191,6 @@ void ViEEncoder::SendKeyFrame() { |
video_sender_.IntraFrameRequest(0); |
} |
-int64_t ViEEncoder::time_of_last_frame_activity_ms() { |
- rtc::CritScope lock(&data_cs_); |
- return time_of_last_frame_activity_ms_; |
-} |
- |
void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { |
if (stats_proxy_) |
stats_proxy_->OnSetRates(bitrate_bps, framerate); |
@@ -201,10 +199,6 @@ void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { |
int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image, |
const CodecSpecificInfo* codec_specific_info, |
const RTPFragmentationHeader* fragmentation) { |
- { |
- rtc::CritScope lock(&data_cs_); |
- time_of_last_frame_activity_ms_ = rtc::TimeMillis(); |
- } |
if (stats_proxy_) { |
stats_proxy_->OnSendEncodedImage(encoded_image, codec_specific_info); |
} |
@@ -256,16 +250,6 @@ void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps, |
last_observed_bitrate_bps_ = bitrate_bps; |
video_suspension_changed = video_suspended_ != video_is_suspended; |
video_suspended_ = video_is_suspended; |
- // Set |time_of_last_frame_activity_ms_| to now if this is the first time |
- // the encoder is supposed to produce encoded frames. |
- // TODO(perkj): Remove this hack. It is here to avoid a race that the |
- // encoder report that it has timed out before it has processed the first |
- // frame. |
- if (last_observed_bitrate_bps_ != 0 && |
- time_of_last_frame_activity_ms_ == |
- std::numeric_limits<int64_t>::max()) { |
- time_of_last_frame_activity_ms_ = rtc::TimeMillis(); |
- } |
} |
if (stats_proxy_ && video_suspension_changed) { |