Skip to content

Commit

Permalink
Identify keyframe packets for FEC protection (open-webrtc-toolkit#106)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
grgustaf authored and jianjunz committed Dec 2, 2022
1 parent 8729625 commit 4f1cc39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/rtp_rtcp/source/rtp_sender_video.cc
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ bool RTPSenderVideo::SendVideo(
packet->set_is_key_frame(video_header.frame_type ==
VideoFrameType::kVideoFrameKey);

packet->set_is_key_frame(video_header.frame_type == VideoFrameType::kVideoFrameKey);

// Put packetization finish timestamp into extension.
if (packet->HasExtension<VideoTimingExtension>()) {
packet->set_packetization_finish_time(clock_->CurrentTime());
Expand Down
5 changes: 5 additions & 0 deletions modules/rtp_rtcp/source/ulpfec_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ void UlpfecGenerator::AddPacketAndGenerateFec(const RtpPacketToSend& packet) {
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
RTC_DCHECK(generated_fec_packets_.empty());

// reset state upon async keyframe request
if (keyframe_in_process_ != packet.is_key_frame()) {
ResetState();
}

{
MutexLock lock(&mutex_);
if (pending_params_) {
Expand Down

0 comments on commit 4f1cc39

Please sign in to comment.