New method RtpReceiver::GetLatestTimestamps.
The two timestamps, rtp time and corresponding system time, are always used together, for audio/video sync. The new method reads both timestamps, without releasing a lock in between. Ensures that the caller gets values corresponding to the same packet. Bug: webrtc:7135 Change-Id: I25bdcbe9ad620016bfad39841b339c266efade14 Reviewed-on: https://webrtc-review.googlesource.com/4062 Commit-Queue: Niels Moller <nisse@webrtc.org> Commit-Queue: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20120}
This commit is contained in:
@ -185,8 +185,11 @@ TEST_F(RtpRtcpAudioTest, Basic) {
|
||||
|
||||
EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC());
|
||||
uint32_t timestamp;
|
||||
EXPECT_TRUE(rtp_receiver2_->Timestamp(×tamp));
|
||||
int64_t receive_time_ms;
|
||||
EXPECT_TRUE(
|
||||
rtp_receiver2_->GetLatestTimestamps(×tamp, &receive_time_ms));
|
||||
EXPECT_EQ(test_timestamp, timestamp);
|
||||
EXPECT_EQ(fake_clock.TimeInMilliseconds(), receive_time_ms);
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpAudioTest, DTMF) {
|
||||
@ -264,23 +267,30 @@ TEST_F(RtpRtcpAudioTest, ComfortNoise) {
|
||||
uint32_t in_timestamp = 0;
|
||||
for (const auto& c : kCngCodecs) {
|
||||
uint32_t timestamp;
|
||||
int64_t receive_time_ms;
|
||||
EXPECT_TRUE(module1->SendOutgoingData(
|
||||
webrtc::kAudioFrameSpeech, kPcmuPayloadType, in_timestamp, -1,
|
||||
kTestPayload, 4, nullptr, nullptr, nullptr));
|
||||
|
||||
EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC());
|
||||
EXPECT_TRUE(rtp_receiver2_->Timestamp(×tamp));
|
||||
EXPECT_TRUE(
|
||||
rtp_receiver2_->GetLatestTimestamps(×tamp, &receive_time_ms));
|
||||
EXPECT_EQ(test_timestamp + in_timestamp, timestamp);
|
||||
EXPECT_EQ(fake_clock.TimeInMilliseconds(), receive_time_ms);
|
||||
in_timestamp += 10;
|
||||
fake_clock.AdvanceTimeMilliseconds(20);
|
||||
|
||||
EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameCN, c.payload_type,
|
||||
in_timestamp, -1, kTestPayload, 1,
|
||||
nullptr, nullptr, nullptr));
|
||||
|
||||
EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC());
|
||||
EXPECT_TRUE(rtp_receiver2_->Timestamp(×tamp));
|
||||
EXPECT_TRUE(
|
||||
rtp_receiver2_->GetLatestTimestamps(×tamp, &receive_time_ms));
|
||||
EXPECT_EQ(test_timestamp + in_timestamp, timestamp);
|
||||
EXPECT_EQ(fake_clock.TimeInMilliseconds(), receive_time_ms);
|
||||
in_timestamp += 10;
|
||||
fake_clock.AdvanceTimeMilliseconds(20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user