Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit e7fb378

Browse files
authored
Identify keyframe packets for FEC protection (#106)
There is code to set different protection levels for keyframes vs. delta frames, but because this set_is_key_frame was never called, the distinction was never used. Also, clear old media packets from a previous frame, which can happen if a keyframe request comes from the receiver.
1 parent ba0bea3 commit e7fb378

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

modules/rtp_rtcp/source/rtp_sender_video.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ bool RTPSenderVideo::SendVideo(
619619

620620
packet->set_allow_retransmission(allow_retransmission);
621621

622+
packet->set_is_key_frame(video_header.frame_type == VideoFrameType::kVideoFrameKey);
623+
622624
// Put packetization finish timestamp into extension.
623625
if (packet->HasExtension<VideoTimingExtension>()) {
624626
packet->set_packetization_finish_time_ms(clock_->TimeInMilliseconds());

modules/rtp_rtcp/source/ulpfec_generator.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ void UlpfecGenerator::AddPacketAndGenerateFec(const RtpPacketToSend& packet) {
111111
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
112112
RTC_DCHECK(generated_fec_packets_.empty());
113113

114+
// reset state upon async keyframe request
115+
if (keyframe_in_process_ != packet.is_key_frame()) {
116+
ResetState();
117+
}
118+
114119
if (media_packets_.empty()) {
115120
rtc::CritScope cs(&crit_);
116121
if (pending_params_) {
@@ -126,7 +131,6 @@ void UlpfecGenerator::AddPacketAndGenerateFec(const RtpPacketToSend& packet) {
126131

127132
keyframe_in_process_ = packet.is_key_frame();
128133
}
129-
RTC_DCHECK_EQ(packet.is_key_frame(), keyframe_in_process_);
130134

131135
bool complete_frame = false;
132136
const bool marker_bit = packet.Marker();

0 commit comments

Comments
 (0)