Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: webrtc/modules/rtp_rtcp/source/flexfec_sender.cc

Issue 2912713002: Persist RTP state for FlexFEC. (Closed)
Patch Set: Fix fuzzer and win compile. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/flexfec_sender.cc
diff --git a/webrtc/modules/rtp_rtcp/source/flexfec_sender.cc b/webrtc/modules/rtp_rtcp/source/flexfec_sender.cc
index a2c9ae39adc6bbdc2d16b4f960c7ce2e65f3baa0..feefe3d1ac302da62ff8bf3d0f8a5e89a3bf844e 100644
--- a/webrtc/modules/rtp_rtcp/source/flexfec_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/flexfec_sender.cc
@@ -65,17 +65,21 @@ FlexfecSender::FlexfecSender(
uint32_t protected_media_ssrc,
const std::vector<RtpExtension>& rtp_header_extensions,
rtc::ArrayView<const RtpExtensionSize> extension_sizes,
+ const RtpState* rtp_state,
Clock* clock)
: clock_(clock),
random_(clock_->TimeInMicroseconds()),
last_generated_packet_ms_(-1),
payload_type_(payload_type),
- // Initialize the timestamp offset and RTP sequence numbers randomly.
- // (This is not intended to be cryptographically strong.)
- timestamp_offset_(random_.Rand<uint32_t>()),
+ // Reset RTP state if this is not the first time we are operating.
+ // Otherwise, randomize the initial timestamp offset and RTP sequence
+ // numbers. (This is not intended to be cryptographically strong.)
+ timestamp_offset_(rtp_state ? rtp_state->start_timestamp
+ : random_.Rand<uint32_t>()),
ssrc_(ssrc),
protected_media_ssrc_(protected_media_ssrc),
- seq_num_(random_.Rand(1, kMaxInitRtpSeqNumber)),
+ seq_num_(rtp_state ? rtp_state->sequence_number
+ : random_.Rand(1, kMaxInitRtpSeqNumber)),
ulpfec_generator_(ForwardErrorCorrection::CreateFlexfec()),
rtp_header_extension_map_(RegisterBweExtensions(rtp_header_extensions)),
header_extensions_size_(
@@ -154,4 +158,11 @@ size_t FlexfecSender::MaxPacketOverhead() const {
return header_extensions_size_ + kFlexfecMaxHeaderSize;
}
+RtpState FlexfecSender::GetRtpState() {
+ RtpState rtp_state;
+ rtp_state.sequence_number = seq_num_;
+ rtp_state.start_timestamp = timestamp_offset_;
+ return rtp_state;
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698