Passing the estimated capture clock offset to SendVideo.

Bug: webrtc:10739
Change-Id: I491db1910fad9101c7c9087e880862e755dfc69d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182184
Reviewed-by: Chen Xing <chxg@google.com>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31983}
This commit is contained in:
Minyue Li
2020-08-21 16:28:07 +02:00
committed by Commit Bot
parent 70b2cf8b36
commit d37b0ec2bb
3 changed files with 17 additions and 9 deletions

View File

@ -399,7 +399,8 @@ bool RTPSenderVideo::SendVideo(
int64_t capture_time_ms,
rtc::ArrayView<const uint8_t> payload,
RTPVideoHeader video_header,
absl::optional<int64_t> expected_retransmission_time_ms) {
absl::optional<int64_t> expected_retransmission_time_ms,
absl::optional<int64_t> 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<RtpPacketToSend>(*single_packet);

View File

@ -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<VideoCodecType> codec_type,
uint32_t rtp_timestamp,
int64_t capture_time_ms,
rtc::ArrayView<const uint8_t> payload,
RTPVideoHeader video_header,
absl::optional<int64_t> expected_retransmission_time_ms);
absl::optional<int64_t> expected_retransmission_time_ms,
absl::optional<int64_t> estimated_capture_clock_offset_ms = 0);
bool SendEncodedImage(
int payload_type,

View File

@ -867,10 +867,12 @@ TEST_P(RtpSenderVideoTest, AbsoluteCaptureTimeWithCaptureClockOffset) {
kAbsoluteCaptureTimeExtensionId);
RTPVideoHeader hdr;
const absl::optional<int64_t> 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);