Fixed timestamp_offset for RtpSenderEgress during initialization and SetRtpState call
The constructor and SetRtpState calls for ModuleRtpRtcpImpl2 class fail to propagate the RTP timestamp offset of RtpSender class to RtpSenderEgress class. This results in wrong RTP timestamps being propagated in LossNotification messages. Change-Id: I1d293289a4815de29d9dd15208bb7fd1a682be82 Bug: webrtc:14719 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284824 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Commit-Queue: Dan Tan <dwtan@google.com> Cr-Commit-Position: refs/heads/main@{#38768}
This commit is contained in:
parent
41a8357170
commit
8b47ea459e
@ -89,6 +89,8 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration)
|
|||||||
// Make sure rtcp sender use same timestamp offset as rtp sender.
|
// Make sure rtcp sender use same timestamp offset as rtp sender.
|
||||||
rtcp_sender_.SetTimestampOffset(
|
rtcp_sender_.SetTimestampOffset(
|
||||||
rtp_sender_->packet_generator.TimestampOffset());
|
rtp_sender_->packet_generator.TimestampOffset());
|
||||||
|
rtp_sender_->packet_sender.SetTimestampOffset(
|
||||||
|
rtp_sender_->packet_generator.TimestampOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default packet size limit.
|
// Set default packet size limit.
|
||||||
@ -186,6 +188,7 @@ void ModuleRtpRtcpImpl2::SetRtpState(const RtpState& rtp_state) {
|
|||||||
rtp_sender_->packet_generator.SetRtpState(rtp_state);
|
rtp_sender_->packet_generator.SetRtpState(rtp_state);
|
||||||
rtp_sender_->sequencer.SetRtpState(rtp_state);
|
rtp_sender_->sequencer.SetRtpState(rtp_state);
|
||||||
rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp);
|
rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp);
|
||||||
|
rtp_sender_->packet_sender.SetTimestampOffset(rtp_state.start_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuleRtpRtcpImpl2::SetRtxState(const RtpState& rtp_state) {
|
void ModuleRtpRtcpImpl2::SetRtxState(const RtpState& rtp_state) {
|
||||||
|
|||||||
@ -709,6 +709,36 @@ TEST_P(RtpRtcpImpl2Test, ConfigurableRtcpReportInterval) {
|
|||||||
EXPECT_EQ(sender_.transport_.NumRtcpSent(), 2u);
|
EXPECT_EQ(sender_.transport_.NumRtcpSent(), 2u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(RtpRtcpImpl2Test, RtpSenderEgressTimestampOffset) {
|
||||||
|
// RTP timestamp offset not explicitly set, default to random value.
|
||||||
|
uint16_t seqno = sender_.impl_->GetRtpState().sequence_number;
|
||||||
|
uint32_t media_rtp_ts = 1001;
|
||||||
|
uint32_t rtp_ts = media_rtp_ts + sender_.impl_->StartTimestamp();
|
||||||
|
EXPECT_TRUE(SendFrame(&sender_, sender_video_.get(), kBaseLayerTid, rtp_ts,
|
||||||
|
/*capture_time_ms=*/0));
|
||||||
|
AdvanceTime(kOneWayNetworkDelay);
|
||||||
|
EXPECT_THAT(
|
||||||
|
sender_.impl_->GetSentRtpPacketInfos(std::vector<uint16_t>{seqno}),
|
||||||
|
ElementsAre(Field(&RtpSequenceNumberMap::Info::timestamp, media_rtp_ts)));
|
||||||
|
|
||||||
|
RtpState saved_rtp_state = sender_.impl_->GetRtpState();
|
||||||
|
|
||||||
|
// Change RTP timestamp offset.
|
||||||
|
sender_.impl_->SetStartTimestamp(2000);
|
||||||
|
|
||||||
|
// Restores RtpState and make sure the old timestamp offset is in place.
|
||||||
|
sender_.impl_->SetRtpState(saved_rtp_state);
|
||||||
|
seqno = sender_.impl_->GetRtpState().sequence_number;
|
||||||
|
media_rtp_ts = 1031;
|
||||||
|
rtp_ts = media_rtp_ts + sender_.impl_->StartTimestamp();
|
||||||
|
EXPECT_TRUE(SendFrame(&sender_, sender_video_.get(), kBaseLayerTid, rtp_ts,
|
||||||
|
/*capture_time_ms=*/0));
|
||||||
|
AdvanceTime(kOneWayNetworkDelay);
|
||||||
|
EXPECT_THAT(
|
||||||
|
sender_.impl_->GetSentRtpPacketInfos(std::vector<uint16_t>{seqno}),
|
||||||
|
ElementsAre(Field(&RtpSequenceNumberMap::Info::timestamp, media_rtp_ts)));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_P(RtpRtcpImpl2Test, StoresPacketInfoForSentPackets) {
|
TEST_P(RtpRtcpImpl2Test, StoresPacketInfoForSentPackets) {
|
||||||
const uint32_t kStartTimestamp = 1u;
|
const uint32_t kStartTimestamp = 1u;
|
||||||
SetUp();
|
SetUp();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user