Send keyframe request if the DependencyDescriptor fail to parse due to missing video structure.

Bug: b/233610247
Change-Id: If471d9b81906c04f50a5f63e26408968adc8c275
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265392
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37196}
This commit is contained in:
philipel
2022-06-13 13:14:43 +02:00
committed by WebRTC LUCI CQ
parent a6ed749b12
commit 1709341fd9
3 changed files with 34 additions and 1 deletions

View File

@ -526,8 +526,18 @@ void RtpVideoStreamReceiver2::OnReceivedPayloadData(
rtp_packet, video_header.frame_type == VideoFrameType::kVideoFrameKey);
}
if (generic_descriptor_state == kDropPacket)
if (generic_descriptor_state == kDropPacket) {
Timestamp now = clock_->CurrentTime();
if (video_structure_ == nullptr &&
next_keyframe_request_for_missing_video_structure_ < now) {
// No video structure received yet, most likely part of the initial
// keyframe was lost.
RequestKeyFrame();
next_keyframe_request_for_missing_video_structure_ =
now + TimeDelta::Seconds(1);
}
return;
}
// Color space should only be transmitted in the last packet of a frame,
// therefore, neglect it otherwise so that last_color_space_ is not reset by

View File

@ -404,6 +404,9 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
RTC_GUARDED_BY(packet_sequence_checker_);
std::map<int64_t, RtpPacketInfo> packet_infos_
RTC_GUARDED_BY(packet_sequence_checker_);
Timestamp next_keyframe_request_for_missing_video_structure_ =
Timestamp::MinusInfinity();
};
} // namespace webrtc

View File

@ -1109,6 +1109,26 @@ TEST_F(RtpVideoStreamReceiver2DependencyDescriptorTest,
InjectPacketWith(stream_structure2, deltaframe_descriptor);
}
TEST_F(RtpVideoStreamReceiver2DependencyDescriptorTest,
RequestKeyframeIfInitialKeyframePacketIsLost) {
FrameDependencyStructure stream_structure = CreateStreamStructure();
DependencyDescriptor keyframe_descriptor_without_structure;
keyframe_descriptor_without_structure.frame_dependencies =
stream_structure.templates[0];
keyframe_descriptor_without_structure.frame_number = 0;
EXPECT_CALL(mock_key_frame_request_sender_, RequestKeyFrame).Times(2);
InjectPacketWith(stream_structure, keyframe_descriptor_without_structure);
// Not enough time since last keyframe request
time_controller_.AdvanceTime(TimeDelta::Millis(500));
InjectPacketWith(stream_structure, keyframe_descriptor_without_structure);
time_controller_.AdvanceTime(TimeDelta::Millis(501));
InjectPacketWith(stream_structure, keyframe_descriptor_without_structure);
}
TEST_F(RtpVideoStreamReceiver2Test, TransformFrame) {
rtc::scoped_refptr<MockFrameTransformer> mock_frame_transformer =
rtc::make_ref_counted<testing::NiceMock<MockFrameTransformer>>();