зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1812154 - Vendor libwebrtc from a1d035655e
Upstream commit: https://webrtc.googlesource.com/src/+/a1d035655eb6e3a73ae5ab16882987327d7bc643 `RtpPacketInfo`: new ctor + deprecated ctors clean-up New ctor added without optional and media specific fields. Bug: webrtc:10739, b/246753278 Change-Id: I7e15849aced6ed0a7ada725ea171a15ea1e9bc5a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275941 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38124}
This commit is contained in:
Родитель
01370ec02e
Коммит
a6f7c74929
|
@ -17949,3 +17949,6 @@ e3b410f54a
|
|||
# MOZ_LIBWEBRTC_SRC=/Users/danielbaker/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
7d1f6bb86c
|
||||
# MOZ_LIBWEBRTC_SRC=/Users/danielbaker/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
a1d035655e
|
||||
|
|
|
@ -11988,3 +11988,5 @@ libwebrtc updated from /Users/danielbaker/moz-libwebrtc commit mozpatches on 202
|
|||
libwebrtc updated from /Users/danielbaker/moz-libwebrtc commit mozpatches on 2023-01-31T23:50:47.653872.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /Users/danielbaker/moz-libwebrtc commit mozpatches on 2023-01-31T23:52:08.212312.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /Users/danielbaker/moz-libwebrtc commit mozpatches on 2023-01-31T23:53:27.148891.
|
||||
|
|
|
@ -18,6 +18,15 @@ namespace webrtc {
|
|||
RtpPacketInfo::RtpPacketInfo()
|
||||
: ssrc_(0), rtp_timestamp_(0), receive_time_(Timestamp::MinusInfinity()) {}
|
||||
|
||||
RtpPacketInfo::RtpPacketInfo(uint32_t ssrc,
|
||||
std::vector<uint32_t> csrcs,
|
||||
uint32_t rtp_timestamp,
|
||||
Timestamp receive_time)
|
||||
: ssrc_(ssrc),
|
||||
csrcs_(std::move(csrcs)),
|
||||
rtp_timestamp_(rtp_timestamp),
|
||||
receive_time_(receive_time) {}
|
||||
|
||||
RtpPacketInfo::RtpPacketInfo(
|
||||
uint32_t ssrc,
|
||||
std::vector<uint32_t> csrcs,
|
||||
|
@ -28,9 +37,9 @@ RtpPacketInfo::RtpPacketInfo(
|
|||
: ssrc_(ssrc),
|
||||
csrcs_(std::move(csrcs)),
|
||||
rtp_timestamp_(rtp_timestamp),
|
||||
receive_time_(receive_time),
|
||||
audio_level_(audio_level),
|
||||
absolute_capture_time_(absolute_capture_time),
|
||||
receive_time_(receive_time) {}
|
||||
absolute_capture_time_(absolute_capture_time) {}
|
||||
|
||||
RtpPacketInfo::RtpPacketInfo(const RTPHeader& rtp_header,
|
||||
Timestamp receive_time)
|
||||
|
@ -69,11 +78,10 @@ RtpPacketInfo::RtpPacketInfo(const RTPHeader& rtp_header,
|
|||
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs) {
|
||||
return (lhs.ssrc() == rhs.ssrc()) && (lhs.csrcs() == rhs.csrcs()) &&
|
||||
(lhs.rtp_timestamp() == rhs.rtp_timestamp()) &&
|
||||
(lhs.receive_time() == rhs.receive_time()) &&
|
||||
(lhs.audio_level() == rhs.audio_level()) &&
|
||||
(lhs.absolute_capture_time() == rhs.absolute_capture_time()) &&
|
||||
(lhs.receive_time() == rhs.receive_time() &&
|
||||
(lhs.local_capture_clock_offset() ==
|
||||
rhs.local_capture_clock_offset()));
|
||||
(lhs.local_capture_clock_offset() == rhs.local_capture_clock_offset());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -31,6 +31,13 @@ class RTC_EXPORT RtpPacketInfo {
|
|||
public:
|
||||
RtpPacketInfo();
|
||||
|
||||
RtpPacketInfo(uint32_t ssrc,
|
||||
std::vector<uint32_t> csrcs,
|
||||
uint32_t rtp_timestamp,
|
||||
Timestamp receive_time);
|
||||
|
||||
// TODO(bugs.webrtc.org/12722): Deprecated, remove once downstream projects
|
||||
// are updated.
|
||||
RtpPacketInfo(uint32_t ssrc,
|
||||
std::vector<uint32_t> csrcs,
|
||||
uint32_t rtp_timestamp,
|
||||
|
@ -64,31 +71,36 @@ class RTC_EXPORT RtpPacketInfo {
|
|||
uint32_t rtp_timestamp() const { return rtp_timestamp_; }
|
||||
void set_rtp_timestamp(uint32_t value) { rtp_timestamp_ = value; }
|
||||
|
||||
absl::optional<uint8_t> audio_level() const { return audio_level_; }
|
||||
void set_audio_level(absl::optional<uint8_t> value) { audio_level_ = value; }
|
||||
|
||||
const absl::optional<AbsoluteCaptureTime>& absolute_capture_time() const {
|
||||
return absolute_capture_time_;
|
||||
}
|
||||
void set_absolute_capture_time(
|
||||
const absl::optional<AbsoluteCaptureTime>& value) {
|
||||
absolute_capture_time_ = value;
|
||||
}
|
||||
|
||||
const absl::optional<int64_t>& local_capture_clock_offset() const {
|
||||
return local_capture_clock_offset_;
|
||||
}
|
||||
|
||||
void set_local_capture_clock_offset(const absl::optional<int64_t>& value) {
|
||||
local_capture_clock_offset_ = value;
|
||||
}
|
||||
|
||||
Timestamp receive_time() const { return receive_time_; }
|
||||
void set_receive_time(Timestamp value) { receive_time_ = value; }
|
||||
// TODO(bugs.webrtc.org/12722): Deprecated, remove once downstream projects
|
||||
// are updated.
|
||||
int64_t receive_time_ms() const { return receive_time_.ms(); }
|
||||
|
||||
absl::optional<uint8_t> audio_level() const { return audio_level_; }
|
||||
RtpPacketInfo& set_audio_level(absl::optional<uint8_t> value) {
|
||||
audio_level_ = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const absl::optional<AbsoluteCaptureTime>& absolute_capture_time() const {
|
||||
return absolute_capture_time_;
|
||||
}
|
||||
RtpPacketInfo& set_absolute_capture_time(
|
||||
const absl::optional<AbsoluteCaptureTime>& value) {
|
||||
absolute_capture_time_ = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const absl::optional<int64_t>& local_capture_clock_offset() const {
|
||||
return local_capture_clock_offset_;
|
||||
}
|
||||
RtpPacketInfo& set_local_capture_clock_offset(
|
||||
const absl::optional<int64_t>& value) {
|
||||
local_capture_clock_offset_ = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
// Fields from the RTP header:
|
||||
// https://tools.ietf.org/html/rfc3550#section-5.1
|
||||
|
@ -96,6 +108,9 @@ class RTC_EXPORT RtpPacketInfo {
|
|||
std::vector<uint32_t> csrcs_;
|
||||
uint32_t rtp_timestamp_;
|
||||
|
||||
// Local `webrtc::Clock`-based timestamp of when the packet was received.
|
||||
Timestamp receive_time_;
|
||||
|
||||
// Fields from the Audio Level header extension:
|
||||
// https://tools.ietf.org/html/rfc6464#section-3
|
||||
absl::optional<uint8_t> audio_level_;
|
||||
|
@ -112,9 +127,6 @@ class RTC_EXPORT RtpPacketInfo {
|
|||
// Clock offset against capturer's clock. Should be derived from the estimated
|
||||
// capture clock offset defined in the Absolute Capture Time header extension.
|
||||
absl::optional<int64_t> local_capture_clock_offset_;
|
||||
|
||||
// Local `webrtc::Clock`-based timestamp of when the packet was received.
|
||||
Timestamp receive_time_;
|
||||
};
|
||||
|
||||
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
namespace webrtc {
|
||||
|
||||
TEST(RtpPacketInfoTest, Ssrc) {
|
||||
const uint32_t value = 4038189233;
|
||||
constexpr uint32_t kValue = 4038189233;
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
@ -23,8 +23,8 @@ TEST(RtpPacketInfoTest, Ssrc) {
|
|||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_ssrc(value);
|
||||
EXPECT_EQ(rhs.ssrc(), value);
|
||||
rhs.set_ssrc(kValue);
|
||||
EXPECT_EQ(rhs.ssrc(), kValue);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
@ -35,10 +35,11 @@ TEST(RtpPacketInfoTest, Ssrc) {
|
|||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.ssrc(), value);
|
||||
EXPECT_NE(rhs.ssrc(), kValue);
|
||||
|
||||
rhs = RtpPacketInfo(value, {}, {}, {}, {}, Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.ssrc(), value);
|
||||
rhs = RtpPacketInfo(/*ssrc=*/kValue, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.ssrc(), kValue);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, Csrcs) {
|
||||
|
@ -64,12 +65,13 @@ TEST(RtpPacketInfoTest, Csrcs) {
|
|||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.csrcs(), value);
|
||||
|
||||
rhs = RtpPacketInfo({}, value, {}, {}, {}, Timestamp::Zero());
|
||||
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/value, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.csrcs(), value);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, RtpTimestamp) {
|
||||
const uint32_t value = 4038189233;
|
||||
constexpr uint32_t kValue = 4038189233;
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
@ -77,8 +79,8 @@ TEST(RtpPacketInfoTest, RtpTimestamp) {
|
|||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_rtp_timestamp(value);
|
||||
EXPECT_EQ(rhs.rtp_timestamp(), value);
|
||||
rhs.set_rtp_timestamp(kValue);
|
||||
EXPECT_EQ(rhs.rtp_timestamp(), kValue);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
@ -89,97 +91,15 @@ TEST(RtpPacketInfoTest, RtpTimestamp) {
|
|||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.rtp_timestamp(), value);
|
||||
EXPECT_NE(rhs.rtp_timestamp(), kValue);
|
||||
|
||||
rhs = RtpPacketInfo({}, {}, value, {}, {}, Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.rtp_timestamp(), value);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, AudioLevel) {
|
||||
const absl::optional<uint8_t> value = 31;
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_audio_level(value);
|
||||
EXPECT_EQ(rhs.audio_level(), value);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
||||
lhs = rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.audio_level(), value);
|
||||
|
||||
rhs = RtpPacketInfo({}, {}, {}, value, {}, Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.audio_level(), value);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, AbsoluteCaptureTime) {
|
||||
const absl::optional<AbsoluteCaptureTime> value = AbsoluteCaptureTime{12, 34};
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_absolute_capture_time(value);
|
||||
EXPECT_EQ(rhs.absolute_capture_time(), value);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
||||
lhs = rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.absolute_capture_time(), value);
|
||||
|
||||
rhs = RtpPacketInfo({}, {}, {}, {}, value, Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.absolute_capture_time(), value);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, LocalCaptureClockOffset) {
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
const absl::optional<int64_t> value = 10;
|
||||
rhs.set_local_capture_clock_offset(value);
|
||||
EXPECT_EQ(rhs.local_capture_clock_offset(), value);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
||||
lhs = rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
// Default local capture clock offset is null.
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_EQ(rhs.local_capture_clock_offset(), absl::nullopt);
|
||||
|
||||
// Default local capture clock offset is null.
|
||||
rhs = RtpPacketInfo({}, {}, {}, {}, AbsoluteCaptureTime{12, 34},
|
||||
Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.local_capture_clock_offset(), absl::nullopt);
|
||||
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/kValue,
|
||||
/*receive_time=*/Timestamp::Zero());
|
||||
EXPECT_EQ(rhs.rtp_timestamp(), kValue);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, ReceiveTimeMs) {
|
||||
const Timestamp timestamp = Timestamp::Micros(8868963877546349045LL);
|
||||
constexpr Timestamp kValue = Timestamp::Micros(8868963877546349045LL);
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
@ -187,8 +107,8 @@ TEST(RtpPacketInfoTest, ReceiveTimeMs) {
|
|||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_receive_time(timestamp);
|
||||
EXPECT_EQ(rhs.receive_time(), timestamp);
|
||||
rhs.set_receive_time(kValue);
|
||||
EXPECT_EQ(rhs.receive_time(), kValue);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
@ -199,10 +119,99 @@ TEST(RtpPacketInfoTest, ReceiveTimeMs) {
|
|||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.receive_time(), timestamp);
|
||||
EXPECT_NE(rhs.receive_time(), kValue);
|
||||
|
||||
rhs = RtpPacketInfo({}, {}, {}, {}, {}, timestamp);
|
||||
EXPECT_EQ(rhs.receive_time(), timestamp);
|
||||
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/kValue);
|
||||
EXPECT_EQ(rhs.receive_time(), kValue);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, AudioLevel) {
|
||||
constexpr absl::optional<uint8_t> kValue = 31;
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_audio_level(kValue);
|
||||
EXPECT_EQ(rhs.audio_level(), kValue);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
||||
lhs = rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.audio_level(), kValue);
|
||||
|
||||
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Timestamp::Zero());
|
||||
rhs.set_audio_level(kValue);
|
||||
EXPECT_EQ(rhs.audio_level(), kValue);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, AbsoluteCaptureTime) {
|
||||
constexpr absl::optional<AbsoluteCaptureTime> kValue = AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 12, .estimated_capture_clock_offset = 34};
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_absolute_capture_time(kValue);
|
||||
EXPECT_EQ(rhs.absolute_capture_time(), kValue);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
||||
lhs = rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_NE(rhs.absolute_capture_time(), kValue);
|
||||
|
||||
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Timestamp::Zero());
|
||||
rhs.set_absolute_capture_time(kValue);
|
||||
EXPECT_EQ(rhs.absolute_capture_time(), kValue);
|
||||
}
|
||||
|
||||
TEST(RtpPacketInfoTest, LocalCaptureClockOffset) {
|
||||
constexpr absl::optional<int64_t> kValue = 10;
|
||||
|
||||
RtpPacketInfo lhs;
|
||||
RtpPacketInfo rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs.set_local_capture_clock_offset(kValue);
|
||||
EXPECT_EQ(rhs.local_capture_clock_offset(), kValue);
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
EXPECT_TRUE(lhs != rhs);
|
||||
|
||||
lhs = rhs;
|
||||
|
||||
EXPECT_TRUE(lhs == rhs);
|
||||
EXPECT_FALSE(lhs != rhs);
|
||||
|
||||
rhs = RtpPacketInfo();
|
||||
EXPECT_EQ(rhs.local_capture_clock_offset(), absl::nullopt);
|
||||
|
||||
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Timestamp::Zero());
|
||||
rhs.set_local_capture_clock_offset(kValue);
|
||||
EXPECT_EQ(rhs.local_capture_clock_offset(), kValue);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -27,12 +27,23 @@ RtpPacketInfos::vector_type ToVector(Iterator begin, Iterator end) {
|
|||
} // namespace
|
||||
|
||||
TEST(RtpPacketInfosTest, BasicFunctionality) {
|
||||
RtpPacketInfo p0(123, {1, 2}, 89, 5, AbsoluteCaptureTime{45, 78},
|
||||
Timestamp::Millis(7));
|
||||
RtpPacketInfo p1(456, {3, 4}, 89, 4, AbsoluteCaptureTime{13, 21},
|
||||
Timestamp::Millis(1));
|
||||
RtpPacketInfo p2(789, {5, 6}, 88, 1, AbsoluteCaptureTime{99, 78},
|
||||
Timestamp::Millis(7));
|
||||
RtpPacketInfo p0(/*ssrc=*/123, /*csrcs=*/{1, 2}, /*rtp_timestamp=*/89,
|
||||
/*receive_time=*/Timestamp::Millis(7));
|
||||
p0.set_audio_level(5);
|
||||
p0.set_absolute_capture_time(AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 45, .estimated_capture_clock_offset = 78});
|
||||
|
||||
RtpPacketInfo p1(/*ssrc=*/456, /*csrcs=*/{3, 4}, /*rtp_timestamp=*/89,
|
||||
/*receive_time=*/Timestamp::Millis(1));
|
||||
p1.set_audio_level(4);
|
||||
p1.set_absolute_capture_time(AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 13, .estimated_capture_clock_offset = 21});
|
||||
|
||||
RtpPacketInfo p2(/*ssrc=*/789, /*csrcs=*/{5, 6}, /*rtp_timestamp=*/88,
|
||||
/*receive_time=*/Timestamp::Millis(7));
|
||||
p2.set_audio_level(1);
|
||||
p2.set_absolute_capture_time(AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 99, .estimated_capture_clock_offset = 78});
|
||||
|
||||
RtpPacketInfos x({p0, p1, p2});
|
||||
|
||||
|
@ -55,12 +66,23 @@ TEST(RtpPacketInfosTest, BasicFunctionality) {
|
|||
}
|
||||
|
||||
TEST(RtpPacketInfosTest, CopyShareData) {
|
||||
RtpPacketInfo p0(123, {1, 2}, 89, 5, AbsoluteCaptureTime{45, 78},
|
||||
Timestamp::Millis(7));
|
||||
RtpPacketInfo p1(456, {3, 4}, 89, 4, AbsoluteCaptureTime{13, 21},
|
||||
Timestamp::Millis(1));
|
||||
RtpPacketInfo p2(789, {5, 6}, 88, 1, AbsoluteCaptureTime{99, 78},
|
||||
Timestamp::Millis(7));
|
||||
RtpPacketInfo p0(/*ssrc=*/123, /*csrcs=*/{1, 2}, /*rtp_timestamp=*/89,
|
||||
/*receive_time=*/Timestamp::Millis(7));
|
||||
p0.set_audio_level(5);
|
||||
p0.set_absolute_capture_time(AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 45, .estimated_capture_clock_offset = 78});
|
||||
|
||||
RtpPacketInfo p1(/*ssrc=*/456, /*csrcs=*/{3, 4}, /*rtp_timestamp=*/89,
|
||||
/*receive_time=*/Timestamp::Millis(1));
|
||||
p1.set_audio_level(4);
|
||||
p1.set_absolute_capture_time(AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 13, .estimated_capture_clock_offset = 21});
|
||||
|
||||
RtpPacketInfo p2(/*ssrc=*/789, /*csrcs=*/{5, 6}, /*rtp_timestamp=*/88,
|
||||
/*receive_time=*/Timestamp::Millis(7));
|
||||
p2.set_audio_level(1);
|
||||
p2.set_absolute_capture_time(AbsoluteCaptureTime{
|
||||
.absolute_capture_timestamp = 99, .estimated_capture_clock_offset = 78});
|
||||
|
||||
RtpPacketInfos lhs({p0, p1, p2});
|
||||
RtpPacketInfos rhs = lhs;
|
||||
|
|
|
@ -136,9 +136,9 @@ bool RedPayloadSplitter::SplitRed(PacketList* packet_list) {
|
|||
/*ssrc=*/red_packet.packet_info.ssrc(),
|
||||
/*csrcs=*/std::vector<uint32_t>(),
|
||||
/*rtp_timestamp=*/new_packet.timestamp,
|
||||
red_packet.packet_info.audio_level(),
|
||||
/*absolute_capture_time=*/absl::nullopt,
|
||||
/*receive_time=*/red_packet.packet_info.receive_time());
|
||||
new_packet.packet_info.set_audio_level(
|
||||
red_packet.packet_info.audio_level());
|
||||
new_packets.push_front(std::move(new_packet));
|
||||
payload_ptr += payload_length;
|
||||
}
|
||||
|
|
|
@ -665,30 +665,29 @@ TEST(AudioMixer, ShouldIncludeRtpPacketInfoFromAllMixedSources) {
|
|||
const Timestamp kReceiveTime0 = Timestamp::Millis(10);
|
||||
const Timestamp kReceiveTime1 = Timestamp::Millis(20);
|
||||
|
||||
const RtpPacketInfo kPacketInfo0(kSsrc0, {kCsrc0, kCsrc1}, kRtpTimestamp0,
|
||||
kAudioLevel0, absl::nullopt, kReceiveTime0);
|
||||
const RtpPacketInfo kPacketInfo1(kSsrc1, {kCsrc2}, kRtpTimestamp1,
|
||||
kAudioLevel1, absl::nullopt, kReceiveTime1);
|
||||
const RtpPacketInfo kPacketInfo2(kSsrc2, {kCsrc3}, kRtpTimestamp1,
|
||||
kAudioLevel2, absl::nullopt, kReceiveTime1);
|
||||
RtpPacketInfo p0(kSsrc0, {kCsrc0, kCsrc1}, kRtpTimestamp0, kReceiveTime0);
|
||||
p0.set_audio_level(kAudioLevel0);
|
||||
RtpPacketInfo p1(kSsrc1, {kCsrc2}, kRtpTimestamp1, kReceiveTime1);
|
||||
p1.set_audio_level(kAudioLevel1);
|
||||
RtpPacketInfo p2(kSsrc2, {kCsrc3}, kRtpTimestamp1, kReceiveTime1);
|
||||
p2.set_audio_level(kAudioLevel2);
|
||||
|
||||
const auto mixer = AudioMixerImpl::Create();
|
||||
|
||||
MockMixerAudioSource source;
|
||||
source.set_packet_infos(RtpPacketInfos({kPacketInfo0}));
|
||||
source.set_packet_infos(RtpPacketInfos({p0}));
|
||||
mixer->AddSource(&source);
|
||||
ResetFrame(source.fake_frame());
|
||||
mixer->Mix(1, &frame_for_mixing);
|
||||
|
||||
MockMixerAudioSource other_source;
|
||||
other_source.set_packet_infos(RtpPacketInfos({kPacketInfo1, kPacketInfo2}));
|
||||
other_source.set_packet_infos(RtpPacketInfos({p1, p2}));
|
||||
ResetFrame(other_source.fake_frame());
|
||||
mixer->AddSource(&other_source);
|
||||
|
||||
mixer->Mix(/*number_of_channels=*/1, &frame_for_mixing);
|
||||
|
||||
EXPECT_THAT(frame_for_mixing.packet_infos_,
|
||||
UnorderedElementsAre(kPacketInfo0, kPacketInfo1, kPacketInfo2));
|
||||
EXPECT_THAT(frame_for_mixing.packet_infos_, UnorderedElementsAre(p0, p1, p2));
|
||||
}
|
||||
|
||||
TEST(AudioMixer, MixerShouldIncludeRtpPacketInfoFromMixedSourcesOnly) {
|
||||
|
@ -706,25 +705,23 @@ TEST(AudioMixer, MixerShouldIncludeRtpPacketInfoFromMixedSourcesOnly) {
|
|||
const Timestamp kReceiveTime0 = Timestamp::Millis(10);
|
||||
const Timestamp kReceiveTime1 = Timestamp::Millis(20);
|
||||
|
||||
const RtpPacketInfo kPacketInfo0(kSsrc0, {kCsrc0, kCsrc1}, kRtpTimestamp0,
|
||||
kAudioLevel0, absl::nullopt, kReceiveTime0);
|
||||
const RtpPacketInfo kPacketInfo1(kSsrc1, {kCsrc2}, kRtpTimestamp1,
|
||||
kAudioLevelMissing, absl::nullopt,
|
||||
kReceiveTime1);
|
||||
const RtpPacketInfo kPacketInfo2(kSsrc2, {kCsrc3}, kRtpTimestamp1,
|
||||
kAudioLevelMissing, absl::nullopt,
|
||||
kReceiveTime1);
|
||||
RtpPacketInfo p0(kSsrc0, {kCsrc0, kCsrc1}, kRtpTimestamp0, kReceiveTime0);
|
||||
p0.set_audio_level(kAudioLevel0);
|
||||
RtpPacketInfo p1(kSsrc1, {kCsrc2}, kRtpTimestamp1, kReceiveTime1);
|
||||
p1.set_audio_level(kAudioLevelMissing);
|
||||
RtpPacketInfo p2(kSsrc2, {kCsrc3}, kRtpTimestamp1, kReceiveTime1);
|
||||
p2.set_audio_level(kAudioLevelMissing);
|
||||
|
||||
const auto mixer = AudioMixerImpl::Create(/*max_sources_to_mix=*/2);
|
||||
|
||||
MockMixerAudioSource source1;
|
||||
source1.set_packet_infos(RtpPacketInfos({kPacketInfo0}));
|
||||
source1.set_packet_infos(RtpPacketInfos({p0}));
|
||||
mixer->AddSource(&source1);
|
||||
ResetFrame(source1.fake_frame());
|
||||
mixer->Mix(1, &frame_for_mixing);
|
||||
|
||||
MockMixerAudioSource source2;
|
||||
source2.set_packet_infos(RtpPacketInfos({kPacketInfo1}));
|
||||
source2.set_packet_infos(RtpPacketInfos({p1}));
|
||||
ResetFrame(source2.fake_frame());
|
||||
mixer->AddSource(&source2);
|
||||
|
||||
|
@ -732,15 +729,14 @@ TEST(AudioMixer, MixerShouldIncludeRtpPacketInfoFromMixedSourcesOnly) {
|
|||
// We limit the number of sources to mix to 2 and set the third source's VAD
|
||||
// activity to kVadPassive so that it will not be added to the mix.
|
||||
MockMixerAudioSource source3;
|
||||
source3.set_packet_infos(RtpPacketInfos({kPacketInfo2}));
|
||||
source3.set_packet_infos(RtpPacketInfos({p2}));
|
||||
ResetFrame(source3.fake_frame());
|
||||
source3.fake_frame()->vad_activity_ = AudioFrame::kVadPassive;
|
||||
mixer->AddSource(&source3);
|
||||
|
||||
mixer->Mix(/*number_of_channels=*/1, &frame_for_mixing);
|
||||
|
||||
EXPECT_THAT(frame_for_mixing.packet_infos_,
|
||||
UnorderedElementsAre(kPacketInfo0, kPacketInfo1));
|
||||
EXPECT_THAT(frame_for_mixing.packet_infos_, UnorderedElementsAre(p0, p1));
|
||||
}
|
||||
|
||||
class HighOutputRateCalculator : public OutputRateCalculator {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "api/array_view.h"
|
||||
#include "api/rtp_packet_info.h"
|
||||
#include "api/rtp_packet_infos.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "audio/utility/audio_frame_operations.h"
|
||||
#include "modules/audio_mixer/gain_change_calculator.h"
|
||||
#include "modules/audio_mixer/sine_wave_generator.h"
|
||||
|
@ -69,18 +70,15 @@ AudioFrame frame1;
|
|||
AudioFrame frame2;
|
||||
|
||||
void SetUpFrames(int sample_rate_hz, int number_of_channels) {
|
||||
RtpPacketInfo packet_info1(
|
||||
/*ssrc=*/1001, /*csrcs=*/{}, /*rtp_timestamp=*/1000,
|
||||
/*audio_level=*/absl::nullopt, /*absolute_capture_time=*/absl::nullopt,
|
||||
/*receive_time_ms=*/1);
|
||||
RtpPacketInfo packet_info2(
|
||||
/*ssrc=*/4004, /*csrcs=*/{}, /*rtp_timestamp=*/1234,
|
||||
/*audio_level=*/absl::nullopt, /*absolute_capture_time=*/absl::nullopt,
|
||||
/*receive_time_ms=*/2);
|
||||
RtpPacketInfo packet_info3(
|
||||
/*ssrc=*/7007, /*csrcs=*/{}, /*rtp_timestamp=*/1333,
|
||||
/*audio_level=*/absl::nullopt, /*absolute_capture_time=*/absl::nullopt,
|
||||
/*receive_time_ms=*/2);
|
||||
RtpPacketInfo packet_info1(/*ssrc=*/1001, /*csrcs=*/{},
|
||||
/*rtp_timestamp=*/1000,
|
||||
/*receive_time=*/Timestamp::Millis(1));
|
||||
RtpPacketInfo packet_info2(/*ssrc=*/4004, /*csrcs=*/{},
|
||||
/*rtp_timestamp=*/1234,
|
||||
/*receive_time=*/Timestamp::Millis(2));
|
||||
RtpPacketInfo packet_info3(/*ssrc=*/7007, /*csrcs=*/{},
|
||||
/*rtp_timestamp=*/1333,
|
||||
/*receive_time=*/Timestamp::Millis(2));
|
||||
|
||||
frame1.packet_infos_ = RtpPacketInfos({packet_info1});
|
||||
frame2.packet_infos_ = RtpPacketInfos({packet_info2, packet_info3});
|
||||
|
|
|
@ -108,10 +108,11 @@ class SourceTrackerRandomTest
|
|||
|
||||
RtpPacketInfos::vector_type packet_infos;
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
packet_infos.emplace_back(GenerateSsrc(), GenerateCsrcs(),
|
||||
GenerateRtpTimestamp(), GenerateAudioLevel(),
|
||||
GenerateAbsoluteCaptureTime(),
|
||||
GenerateReceiveTime());
|
||||
packet_infos
|
||||
.emplace_back(GenerateSsrc(), GenerateCsrcs(), GenerateRtpTimestamp(),
|
||||
GenerateReceiveTime())
|
||||
.set_audio_level(GenerateAudioLevel())
|
||||
.set_absolute_capture_time(GenerateAbsoluteCaptureTime());
|
||||
}
|
||||
|
||||
return RtpPacketInfos(std::move(packet_infos));
|
||||
|
@ -260,10 +261,12 @@ TEST(SourceTrackerTest, OnFrameDeliveredRecordsSourcesDistinctSsrcs) {
|
|||
SourceTracker tracker(&clock);
|
||||
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc1, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kAudioLevel0,
|
||||
kAbsoluteCaptureTime, kReceiveTime0),
|
||||
RtpPacketInfo(kSsrc2, {kCsrcs2}, kRtpTimestamp1, kAudioLevel1,
|
||||
kAbsoluteCaptureTime, kReceiveTime1)}));
|
||||
{RtpPacketInfo(kSsrc1, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kReceiveTime0)
|
||||
.set_audio_level(kAudioLevel0)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime),
|
||||
RtpPacketInfo(kSsrc2, {kCsrcs2}, kRtpTimestamp1, kReceiveTime1)
|
||||
.set_audio_level(kAudioLevel1)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime)}));
|
||||
|
||||
int64_t timestamp_ms = clock.TimeInMilliseconds();
|
||||
constexpr RtpSource::Extensions extensions0 = {
|
||||
|
@ -307,13 +310,17 @@ TEST(SourceTrackerTest, OnFrameDeliveredRecordsSourcesSameSsrc) {
|
|||
SimulatedClock clock(1000000000000ULL);
|
||||
SourceTracker tracker(&clock);
|
||||
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kAudioLevel0,
|
||||
kAbsoluteCaptureTime, kReceiveTime0),
|
||||
RtpPacketInfo(kSsrc, {kCsrcs2}, kRtpTimestamp1, kAudioLevel1,
|
||||
kAbsoluteCaptureTime, kReceiveTime1),
|
||||
RtpPacketInfo(kSsrc, {kCsrcs0}, kRtpTimestamp2, kAudioLevel2,
|
||||
kAbsoluteCaptureTime, kReceiveTime2)}));
|
||||
tracker.OnFrameDelivered(RtpPacketInfos({
|
||||
RtpPacketInfo(kSsrc, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kReceiveTime0)
|
||||
.set_audio_level(kAudioLevel0)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime),
|
||||
RtpPacketInfo(kSsrc, {kCsrcs2}, kRtpTimestamp1, kReceiveTime1)
|
||||
.set_audio_level(kAudioLevel1)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime),
|
||||
RtpPacketInfo(kSsrc, {kCsrcs0}, kRtpTimestamp2, kReceiveTime2)
|
||||
.set_audio_level(kAudioLevel2)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime),
|
||||
}));
|
||||
|
||||
int64_t timestamp_ms = clock.TimeInMilliseconds();
|
||||
constexpr RtpSource::Extensions extensions0 = {kAudioLevel0,
|
||||
|
@ -370,8 +377,9 @@ TEST(SourceTrackerTest, OnFrameDeliveredUpdatesSources) {
|
|||
SourceTracker tracker(&clock);
|
||||
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc1, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kAudioLevel0,
|
||||
kAbsoluteCaptureTime0, kReceiveTime0)}));
|
||||
{RtpPacketInfo(kSsrc1, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kReceiveTime0)
|
||||
.set_audio_level(kAudioLevel0)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime0)}));
|
||||
|
||||
int64_t timestamp_ms_0 = clock.TimeInMilliseconds();
|
||||
EXPECT_THAT(
|
||||
|
@ -387,8 +395,9 @@ TEST(SourceTrackerTest, OnFrameDeliveredUpdatesSources) {
|
|||
|
||||
clock.AdvanceTimeMilliseconds(17);
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc1, {kCsrcs0, kCsrcs2}, kRtpTimestamp1, kAudioLevel1,
|
||||
kAbsoluteCaptureTime1, kReceiveTime1)}));
|
||||
{RtpPacketInfo(kSsrc1, {kCsrcs0, kCsrcs2}, kRtpTimestamp1, kReceiveTime1)
|
||||
.set_audio_level(kAudioLevel1)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime1)}));
|
||||
|
||||
int64_t timestamp_ms_1 = clock.TimeInMilliseconds();
|
||||
|
||||
|
@ -405,9 +414,11 @@ TEST(SourceTrackerTest, OnFrameDeliveredUpdatesSources) {
|
|||
|
||||
// Deliver more packets with update csrcs and a new ssrc.
|
||||
clock.AdvanceTimeMilliseconds(17);
|
||||
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc2, {kCsrcs0}, kRtpTimestamp2, kAudioLevel2,
|
||||
kAbsoluteCaptureTime2, kReceiveTime2)}));
|
||||
{RtpPacketInfo(kSsrc2, {kCsrcs0}, kRtpTimestamp2, kReceiveTime2)
|
||||
.set_audio_level(kAudioLevel2)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime2)}));
|
||||
|
||||
int64_t timestamp_ms_2 = clock.TimeInMilliseconds();
|
||||
|
||||
|
@ -445,14 +456,16 @@ TEST(SourceTrackerTest, TimedOutSourcesAreRemoved) {
|
|||
SourceTracker tracker(&clock);
|
||||
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kAudioLevel0,
|
||||
kAbsoluteCaptureTime0, kReceiveTime0)}));
|
||||
{RtpPacketInfo(kSsrc, {kCsrcs0, kCsrcs1}, kRtpTimestamp0, kReceiveTime0)
|
||||
.set_audio_level(kAudioLevel0)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime0)}));
|
||||
|
||||
clock.AdvanceTimeMilliseconds(17);
|
||||
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(kSsrc, {kCsrcs0, kCsrcs2}, kRtpTimestamp1, kAudioLevel1,
|
||||
kAbsoluteCaptureTime1, kReceiveTime1)}));
|
||||
{RtpPacketInfo(kSsrc, {kCsrcs0, kCsrcs2}, kRtpTimestamp1, kReceiveTime1)
|
||||
.set_audio_level(kAudioLevel1)
|
||||
.set_absolute_capture_time(kAbsoluteCaptureTime1)}));
|
||||
|
||||
int64_t timestamp_ms_1 = clock.TimeInMilliseconds();
|
||||
|
||||
|
|
|
@ -72,8 +72,6 @@ EncodedImage FakeEncode(const VideoFrame& frame) {
|
|||
/*ssrc=*/1,
|
||||
/*csrcs=*/{},
|
||||
/*rtp_timestamp=*/frame.timestamp(),
|
||||
/*audio_level=*/absl::nullopt,
|
||||
/*absolute_capture_time=*/absl::nullopt,
|
||||
/*receive_time=*/Timestamp::Micros(frame.timestamp_us() + 10000)));
|
||||
image.SetPacketInfos(RtpPacketInfos(packet_infos));
|
||||
return image;
|
||||
|
|
|
@ -190,8 +190,8 @@ TEST_F(ReceiveStatisticsProxy2Test, OnDecodedFrameIncreasesProcessingDelay) {
|
|||
// We set receive time fixed and increase the clock by 10ms
|
||||
// in the loop which will increase the processing delay by
|
||||
// 10/20/30ms respectively.
|
||||
RtpPacketInfos::vector_type packet_infos = {
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now())};
|
||||
RtpPacketInfos::vector_type packet_infos = {RtpPacketInfo(
|
||||
/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{}, /*receive_time=*/Now())};
|
||||
frame.set_packet_infos(RtpPacketInfos(packet_infos));
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
time_controller_.AdvanceTime(kProcessingDelay);
|
||||
|
@ -228,8 +228,8 @@ TEST_F(ReceiveStatisticsProxy2Test, OnDecodedFrameIncreasesAssemblyTime) {
|
|||
|
||||
// A single-packet frame will not increase total assembly time
|
||||
// and frames assembled.
|
||||
RtpPacketInfos::vector_type single_packet_frame = {
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now())};
|
||||
RtpPacketInfos::vector_type single_packet_frame = {RtpPacketInfo(
|
||||
/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{}, /*receive_time=*/Now())};
|
||||
frame.set_packet_infos(RtpPacketInfos(single_packet_frame));
|
||||
statistics_proxy_->OnDecodedFrame(frame, absl::nullopt, TimeDelta::Millis(1),
|
||||
VideoContentType::UNSPECIFIED);
|
||||
|
@ -243,9 +243,12 @@ TEST_F(ReceiveStatisticsProxy2Test, OnDecodedFrameIncreasesAssemblyTime) {
|
|||
|
||||
// In an ordered frame the first and last packet matter.
|
||||
RtpPacketInfos::vector_type ordered_frame = {
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now()),
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now() + kAssemblyTime),
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now() + 2 * kAssemblyTime),
|
||||
RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Now()),
|
||||
RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Now() + kAssemblyTime),
|
||||
RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Now() + 2 * kAssemblyTime),
|
||||
};
|
||||
frame.set_packet_infos(RtpPacketInfos(ordered_frame));
|
||||
statistics_proxy_->OnDecodedFrame(frame, 1u, TimeDelta::Millis(3),
|
||||
|
@ -264,9 +267,12 @@ TEST_F(ReceiveStatisticsProxy2Test, OnDecodedFrameIncreasesAssemblyTime) {
|
|||
|
||||
// "First" and "last" are in receive time, not sequence number.
|
||||
RtpPacketInfos::vector_type unordered_frame = {
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now() + 2 * kAssemblyTime),
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now()),
|
||||
RtpPacketInfo({}, {}, {}, {}, {}, Now() + kAssemblyTime),
|
||||
RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Now() + 2 * kAssemblyTime),
|
||||
RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Now()),
|
||||
RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
|
||||
/*receive_time=*/Now() + kAssemblyTime),
|
||||
};
|
||||
frame.set_packet_infos(RtpPacketInfos(unordered_frame));
|
||||
statistics_proxy_->OnDecodedFrame(frame, 1u, TimeDelta::Millis(3),
|
||||
|
|
|
@ -512,15 +512,13 @@ void RtpVideoStreamReceiver2::OnReceivedPayloadData(
|
|||
|
||||
int64_t unwrapped_rtp_seq_num =
|
||||
rtp_seq_num_unwrapper_.Unwrap(rtp_packet.SequenceNumber());
|
||||
auto& packet_info =
|
||||
|
||||
RtpPacketInfo& packet_info =
|
||||
packet_infos_
|
||||
.emplace(
|
||||
unwrapped_rtp_seq_num,
|
||||
RtpPacketInfo(
|
||||
rtp_packet.Ssrc(), rtp_packet.Csrcs(), rtp_packet.Timestamp(),
|
||||
/*audio_level=*/absl::nullopt,
|
||||
rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>(),
|
||||
/*receive_time_ms=*/clock_->CurrentTime()))
|
||||
.emplace(unwrapped_rtp_seq_num,
|
||||
RtpPacketInfo(rtp_packet.Ssrc(), rtp_packet.Csrcs(),
|
||||
rtp_packet.Timestamp(),
|
||||
/*receive_time_ms=*/clock_->CurrentTime()))
|
||||
.first->second;
|
||||
|
||||
// Try to extrapolate absolute capture time if it is missing.
|
||||
|
@ -530,7 +528,8 @@ void RtpVideoStreamReceiver2::OnReceivedPayloadData(
|
|||
packet_info.csrcs()),
|
||||
packet_info.rtp_timestamp(),
|
||||
// Assume frequency is the same one for all video frames.
|
||||
kVideoPayloadTypeFrequency, packet_info.absolute_capture_time()));
|
||||
kVideoPayloadTypeFrequency,
|
||||
rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>()));
|
||||
|
||||
RTPVideoHeader& video_header = packet->video_header;
|
||||
video_header.rotation = kVideoRotation_0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче