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:
@ -399,7 +399,8 @@ bool RTPSenderVideo::SendVideo(
|
|||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
RTPVideoHeader video_header,
|
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
|
#if RTC_TRACE_EVENTS_ENABLED
|
||||||
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", capture_time_ms, "Send", "type",
|
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", capture_time_ms, "Send", "type",
|
||||||
FrameTypeToString(video_header.frame_type));
|
FrameTypeToString(video_header.frame_type));
|
||||||
@ -452,7 +453,7 @@ bool RTPSenderVideo::SendVideo(
|
|||||||
single_packet->Timestamp(), kVideoPayloadTypeFrequency,
|
single_packet->Timestamp(), kVideoPayloadTypeFrequency,
|
||||||
Int64MsToUQ32x32(single_packet->capture_time_ms() + NtpOffsetMs()),
|
Int64MsToUQ32x32(single_packet->capture_time_ms() + NtpOffsetMs()),
|
||||||
/*estimated_capture_clock_offset=*/
|
/*estimated_capture_clock_offset=*/
|
||||||
include_capture_clock_offset_ ? absl::make_optional(0)
|
include_capture_clock_offset_ ? estimated_capture_clock_offset_ms
|
||||||
: absl::nullopt);
|
: absl::nullopt);
|
||||||
|
|
||||||
auto first_packet = std::make_unique<RtpPacketToSend>(*single_packet);
|
auto first_packet = std::make_unique<RtpPacketToSend>(*single_packet);
|
||||||
|
@ -91,13 +91,19 @@ class RTPSenderVideo {
|
|||||||
|
|
||||||
// expected_retransmission_time_ms.has_value() -> retransmission allowed.
|
// expected_retransmission_time_ms.has_value() -> retransmission allowed.
|
||||||
// Calls to this method is assumed to be externally serialized.
|
// 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,
|
bool SendVideo(int payload_type,
|
||||||
absl::optional<VideoCodecType> codec_type,
|
absl::optional<VideoCodecType> codec_type,
|
||||||
uint32_t rtp_timestamp,
|
uint32_t rtp_timestamp,
|
||||||
int64_t capture_time_ms,
|
int64_t capture_time_ms,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
RTPVideoHeader video_header,
|
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(
|
bool SendEncodedImage(
|
||||||
int payload_type,
|
int payload_type,
|
||||||
|
@ -867,10 +867,12 @@ TEST_P(RtpSenderVideoTest, AbsoluteCaptureTimeWithCaptureClockOffset) {
|
|||||||
kAbsoluteCaptureTimeExtensionId);
|
kAbsoluteCaptureTimeExtensionId);
|
||||||
|
|
||||||
RTPVideoHeader hdr;
|
RTPVideoHeader hdr;
|
||||||
|
const absl::optional<int64_t> kExpectedCaptureClockOffset =
|
||||||
|
absl::make_optional(1234);
|
||||||
hdr.frame_type = VideoFrameType::kVideoFrameKey;
|
hdr.frame_type = VideoFrameType::kVideoFrameKey;
|
||||||
rtp_sender_video_->SendVideo(kPayload, kType, kTimestamp,
|
rtp_sender_video_->SendVideo(
|
||||||
kAbsoluteCaptureTimestampMs, kFrame, hdr,
|
kPayload, kType, kTimestamp, kAbsoluteCaptureTimestampMs, kFrame, hdr,
|
||||||
kDefaultExpectedRetransmissionTimeMs);
|
kDefaultExpectedRetransmissionTimeMs, kExpectedCaptureClockOffset);
|
||||||
|
|
||||||
// It is expected that one and only one of the packets sent on this video
|
// 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
|
// frame has absolute capture time header extension. And it includes capture
|
||||||
@ -883,9 +885,8 @@ TEST_P(RtpSenderVideoTest, AbsoluteCaptureTimeWithCaptureClockOffset) {
|
|||||||
++packets_with_abs_capture_time;
|
++packets_with_abs_capture_time;
|
||||||
EXPECT_EQ(absolute_capture_time->absolute_capture_timestamp,
|
EXPECT_EQ(absolute_capture_time->absolute_capture_timestamp,
|
||||||
Int64MsToUQ32x32(kAbsoluteCaptureTimestampMs + NtpOffsetMs()));
|
Int64MsToUQ32x32(kAbsoluteCaptureTimestampMs + NtpOffsetMs()));
|
||||||
EXPECT_TRUE(
|
EXPECT_EQ(kExpectedCaptureClockOffset,
|
||||||
absolute_capture_time->estimated_capture_clock_offset.has_value());
|
absolute_capture_time->estimated_capture_clock_offset);
|
||||||
EXPECT_EQ(0, *absolute_capture_time->estimated_capture_clock_offset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPECT_EQ(packets_with_abs_capture_time, 1);
|
EXPECT_EQ(packets_with_abs_capture_time, 1);
|
||||||
|
Reference in New Issue
Block a user