Delete VideoStreamEncoder::OnReceivedIntraFrameRequest.

Duplicates SendKeyFrame, since current simulcast encoders always
produces key frames for all simulcast layers.

Bug: webrtc:8830
Change-Id: Iec0e46d52de9d85e59fb5b99761416ce027ea876
Reviewed-on: https://webrtc-review.googlesource.com/54300
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22057}
This commit is contained in:
Niels Möller
2018-02-16 10:27:23 +01:00
committed by Commit Bot
parent a0262daed7
commit 1c9aa1ea66
4 changed files with 9 additions and 21 deletions

View File

@ -60,7 +60,8 @@ void EncoderRtcpFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) {
time_last_intra_request_ms_[index] = now_ms;
}
video_stream_encoder_->OnReceivedIntraFrameRequest(index);
// Always produce key frame for all streams.
video_stream_encoder_->SendKeyFrame();
}
} // namespace webrtc

View File

@ -33,7 +33,7 @@ class MockVideoStreamEncoder : public VideoStreamEncoder {
CpuOveruseOptions(), nullptr)) {}
~MockVideoStreamEncoder() { Stop(); }
MOCK_METHOD1(OnReceivedIntraFrameRequest, void(size_t));
MOCK_METHOD0(SendKeyFrame, void());
};
class VieKeyRequestTest : public ::testing::Test {
@ -59,18 +59,18 @@ class VieKeyRequestTest : public ::testing::Test {
};
TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) {
EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1);
EXPECT_CALL(encoder_, SendKeyFrame()).Times(1);
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
}
TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) {
EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1);
EXPECT_CALL(encoder_, SendKeyFrame()).Times(1);
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
simulated_clock_.AdvanceTimeMilliseconds(10);
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1);
EXPECT_CALL(encoder_, SendKeyFrame()).Times(1);
simulated_clock_.AdvanceTimeMilliseconds(300);
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);
encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc);

View File

@ -815,6 +815,7 @@ void VideoStreamEncoder::SendKeyFrame() {
return;
}
RTC_DCHECK_RUN_ON(&encoder_queue_);
TRACE_EVENT0("webrtc", "OnKeyFrameRequest");
video_sender_.IntraFrameRequest(0);
}
@ -873,18 +874,6 @@ void VideoStreamEncoder::OnDroppedFrame(DropReason reason) {
}
}
void VideoStreamEncoder::OnReceivedIntraFrameRequest(size_t stream_index) {
if (!encoder_queue_.IsCurrent()) {
encoder_queue_.PostTask(
[this, stream_index] { OnReceivedIntraFrameRequest(stream_index); });
return;
}
RTC_DCHECK_RUN_ON(&encoder_queue_);
// Key frame request from remote side, signal to VCM.
TRACE_EVENT0("webrtc", "OnKeyFrameRequest");
video_sender_.IntraFrameRequest(stream_index);
}
void VideoStreamEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
uint8_t fraction_lost,
int64_t round_trip_time_ms) {

View File

@ -99,10 +99,8 @@ class VideoStreamEncoder : public rtc::VideoSinkInterface<VideoFrame>,
// guaranteed that no encoded frames will be delivered to the sink.
void Stop();
void SendKeyFrame();
// virtual to test EncoderStateFeedback with mocks.
virtual void OnReceivedIntraFrameRequest(size_t stream_index);
// virtual to test EncoderRtcpFeedback with mocks.
virtual void SendKeyFrame();
void OnBitrateUpdated(uint32_t bitrate_bps,
uint8_t fraction_lost,