Cap amount of warning log messages in generic encoder

Bug: None
Change-Id: I4fe2f027eb92c59eb901c88bf244300252588c27
Reviewed-on: https://webrtc-review.googlesource.com/22921
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20674}
This commit is contained in:
Ilya Nikolaevskiy
2017-11-14 14:13:47 +01:00
committed by Commit Bot
parent 6199a3731d
commit b9fb78f425
2 changed files with 26 additions and 5 deletions

View File

@ -183,7 +183,9 @@ VCMEncodedFrameCallback::VCMEncodedFrameCallback(
media_opt_(media_opt),
framerate_(1),
last_timing_frame_time_ms_(-1),
timing_frames_thresholds_({-1, 0}) {
timing_frames_thresholds_({-1, 0}),
reordered_frames_logged_messages_(0),
stalled_encoder_logged_messages_(0) {
rtc::Optional<AlrDetector::AlrExperimentSettings> experiment_settings =
AlrDetector::ParseAlrSettingsFromFieldTrial(
AlrDetector::kStrictPacingAndProbingExperimentName);
@ -237,8 +239,15 @@ void VCMEncodedFrameCallback::OnEncodeStarted(int64_t capture_time_ms,
return;
if (timing_frames_info_[simulcast_svc_idx].encode_start_list.size() ==
kMaxEncodeStartTimeListSize) {
RTC_LOG(LS_WARNING) << "Too many frames in the encode_start_list."
" Did encoder stall?";
++stalled_encoder_logged_messages_;
if (stalled_encoder_logged_messages_ <= 100) {
RTC_LOG(LS_WARNING) << "Too many frames in the encode_start_list."
" Did encoder stall?";
if (stalled_encoder_logged_messages_ == 100) {
RTC_LOG(LS_WARNING) << "Too many log messages. Further stalled encoder"
"warnings will not be printed.";
}
}
post_encode_callback_->OnDroppedFrame(DropReason::kDroppedByEncoder);
timing_frames_info_[simulcast_svc_idx].encode_start_list.pop_front();
}
@ -292,8 +301,16 @@ EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
encode_start_list->front().encode_start_time_ms);
encode_start_list->pop_front();
} else {
RTC_LOG(LS_WARNING) << "Frame with no encode started time recordings. "
"Encoder may be reordering frames.";
++reordered_frames_logged_messages_;
if (reordered_frames_logged_messages_ <= 100) {
RTC_LOG(LS_WARNING)
<< "Frame with no encode started time recordings. "
"Encoder may be reordering frames.";
if (reordered_frames_logged_messages_ == 100) {
RTC_LOG(LS_WARNING) << "Too many log messages. Further frames "
"reordering warnings will not be printed.";
}
}
}
size_t target_bitrate =

View File

@ -70,6 +70,8 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
rtc::CritScope crit(&timing_params_lock_);
timing_frames_info_.clear();
last_timing_frame_time_ms_ = -1;
reordered_frames_logged_messages_ = 0;
stalled_encoder_logged_messages_ = 0;
}
private:
@ -96,6 +98,8 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
int64_t last_timing_frame_time_ms_ RTC_GUARDED_BY(timing_params_lock_);
VideoCodec::TimingFrameTriggerThresholds timing_frames_thresholds_
RTC_GUARDED_BY(timing_params_lock_);
size_t reordered_frames_logged_messages_ RTC_GUARDED_BY(timing_params_lock_);
size_t stalled_encoder_logged_messages_ RTC_GUARDED_BY(timing_params_lock_);
// Experiment groups parsed from field trials for realtime video ([0]) and
// screenshare ([1]). 0 means no group specified. Positive values are