Don't throttle key-frame requests per layer.

Bug: webrtc:9688
Change-Id: Ia6f8b131412a8f46ad6fa3f0173c3285728bbeeb
Reviewed-on: https://webrtc-review.googlesource.com/100522
Commit-Queue: Magnus Flodman <mflodman@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24791}
This commit is contained in:
Magnus Flodman
2018-09-24 11:44:49 +02:00
committed by Commit Bot
parent 84df1c724e
commit 3c62afd918
2 changed files with 4 additions and 18 deletions

View File

@ -23,7 +23,7 @@ EncoderRtcpFeedback::EncoderRtcpFeedback(Clock* clock,
: clock_(clock),
ssrcs_(ssrcs),
video_stream_encoder_(encoder),
time_last_intra_request_ms_(ssrcs.size(), -1) {
time_last_intra_request_ms_(-1) {
RTC_DCHECK(!ssrcs.empty());
}
@ -36,28 +36,15 @@ bool EncoderRtcpFeedback::HasSsrc(uint32_t ssrc) {
return false;
}
size_t EncoderRtcpFeedback::GetStreamIndex(uint32_t ssrc) {
for (size_t i = 0; i < ssrcs_.size(); ++i) {
if (ssrcs_[i] == ssrc)
return i;
}
RTC_NOTREACHED() << "Unknown ssrc " << ssrc;
return 0;
}
void EncoderRtcpFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) {
RTC_DCHECK(HasSsrc(ssrc));
size_t index = GetStreamIndex(ssrc);
{
// TODO(mflodman): Move to VideoStreamEncoder after some more changes making
// it easier to test there.
int64_t now_ms = clock_->TimeInMilliseconds();
rtc::CritScope lock(&crit_);
if (time_last_intra_request_ms_[index] + kMinKeyFrameRequestIntervalMs >
now_ms) {
if (time_last_intra_request_ms_ + kMinKeyFrameRequestIntervalMs > now_ms) {
return;
}
time_last_intra_request_ms_[index] = now_ms;
time_last_intra_request_ms_ = now_ms;
}
// Always produce key frame for all streams.

View File

@ -29,14 +29,13 @@ class EncoderRtcpFeedback : public RtcpIntraFrameObserver {
private:
bool HasSsrc(uint32_t ssrc);
size_t GetStreamIndex(uint32_t ssrc);
Clock* const clock_;
const std::vector<uint32_t> ssrcs_;
VideoStreamEncoderInterface* const video_stream_encoder_;
rtc::CriticalSection crit_;
std::vector<int64_t> time_last_intra_request_ms_ RTC_GUARDED_BY(crit_);
int64_t time_last_intra_request_ms_ RTC_GUARDED_BY(crit_);
};
} // namespace webrtc