diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc index ea920ecd41..31002aa0df 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video.cc +++ b/modules/rtp_rtcp/source/rtp_sender_video.cc @@ -399,7 +399,8 @@ bool RTPSenderVideo::SendVideo( int64_t capture_time_ms, rtc::ArrayView payload, RTPVideoHeader video_header, - absl::optional expected_retransmission_time_ms) { + absl::optional expected_retransmission_time_ms, + absl::optional estimated_capture_clock_offset_ms) { #if RTC_TRACE_EVENTS_ENABLED TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", capture_time_ms, "Send", "type", FrameTypeToString(video_header.frame_type)); @@ -452,7 +453,7 @@ bool RTPSenderVideo::SendVideo( single_packet->Timestamp(), kVideoPayloadTypeFrequency, Int64MsToUQ32x32(single_packet->capture_time_ms() + NtpOffsetMs()), /*estimated_capture_clock_offset=*/ - include_capture_clock_offset_ ? absl::make_optional(0) + include_capture_clock_offset_ ? estimated_capture_clock_offset_ms : absl::nullopt); auto first_packet = std::make_unique(*single_packet); diff --git a/modules/rtp_rtcp/source/rtp_sender_video.h b/modules/rtp_rtcp/source/rtp_sender_video.h index e82496c3d4..4addb094dd 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video.h +++ b/modules/rtp_rtcp/source/rtp_sender_video.h @@ -91,13 +91,19 @@ class RTPSenderVideo { // expected_retransmission_time_ms.has_value() -> retransmission allowed. // Calls to this method is assumed to be externally serialized. + // |estimated_capture_clock_offset_ms| is an estimated clock offset between + // this sender and the original capturer, for this video packet. See + // http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time for more + // details. If the sender and the capture has the same clock, it is supposed + // to be zero valued, which is given as the default. bool SendVideo(int payload_type, absl::optional codec_type, uint32_t rtp_timestamp, int64_t capture_time_ms, rtc::ArrayView payload, RTPVideoHeader video_header, - absl::optional expected_retransmission_time_ms); + absl::optional expected_retransmission_time_ms, + absl::optional estimated_capture_clock_offset_ms = 0); bool SendEncodedImage( int payload_type, diff --git a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc index bbd8caadba..b114cd271d 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc @@ -867,10 +867,12 @@ TEST_P(RtpSenderVideoTest, AbsoluteCaptureTimeWithCaptureClockOffset) { kAbsoluteCaptureTimeExtensionId); RTPVideoHeader hdr; + const absl::optional kExpectedCaptureClockOffset = + absl::make_optional(1234); hdr.frame_type = VideoFrameType::kVideoFrameKey; - rtp_sender_video_->SendVideo(kPayload, kType, kTimestamp, - kAbsoluteCaptureTimestampMs, kFrame, hdr, - kDefaultExpectedRetransmissionTimeMs); + rtp_sender_video_->SendVideo( + kPayload, kType, kTimestamp, kAbsoluteCaptureTimestampMs, kFrame, hdr, + kDefaultExpectedRetransmissionTimeMs, kExpectedCaptureClockOffset); // It is expected that one and only one of the packets sent on this video // frame has absolute capture time header extension. And it includes capture @@ -883,9 +885,8 @@ TEST_P(RtpSenderVideoTest, AbsoluteCaptureTimeWithCaptureClockOffset) { ++packets_with_abs_capture_time; EXPECT_EQ(absolute_capture_time->absolute_capture_timestamp, Int64MsToUQ32x32(kAbsoluteCaptureTimestampMs + NtpOffsetMs())); - EXPECT_TRUE( - absolute_capture_time->estimated_capture_clock_offset.has_value()); - EXPECT_EQ(0, *absolute_capture_time->estimated_capture_clock_offset); + EXPECT_EQ(kExpectedCaptureClockOffset, + absolute_capture_time->estimated_capture_clock_offset); } } EXPECT_EQ(packets_with_abs_capture_time, 1);