mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Remove internal overrides using old SendRtp and SendRtcp interfaces.
This CL takes away all usages except for Android code. Low-Coverage-Reason: Refactoring old code Bug: webrtc:15410 Change-Id: I66bed6a4a2787b4177a82e599b48623ca67cd235 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/315940 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40554}
This commit is contained in:
parent
5165743926
commit
d43af9172b
55 changed files with 360 additions and 412 deletions
|
@ -49,9 +49,9 @@ TEST_F(AudioSendStreamCallTest, SupportsCName) {
|
|||
CNameObserver() = default;
|
||||
|
||||
private:
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
if (parser.sdes()->num_packets() > 0) {
|
||||
EXPECT_EQ(1u, parser.sdes()->chunks().size());
|
||||
EXPECT_EQ(kCName, parser.sdes()->chunks()[0].cname);
|
||||
|
@ -82,9 +82,9 @@ TEST_F(AudioSendStreamCallTest, NoExtensionsByDefault) {
|
|||
NoExtensionsObserver() = default;
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length)); // rtp packet is valid.
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet)); // rtp packet is valid.
|
||||
EXPECT_EQ(packet[0] & 0b0001'0000, 0); // extension bit not set.
|
||||
|
||||
observation_complete_.Set();
|
||||
|
@ -112,9 +112,9 @@ TEST_F(AudioSendStreamCallTest, SupportsAudioLevel) {
|
|||
extensions_.Register<AudioLevel>(kAudioLevelExtensionId);
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
uint8_t audio_level = 0;
|
||||
bool voice = false;
|
||||
|
@ -158,9 +158,9 @@ class TransportWideSequenceNumberObserver : public AudioSendTest {
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_EQ(rtp_packet.HasExtension<TransportSequenceNumber>(),
|
||||
expect_sequence_number_);
|
||||
|
@ -204,9 +204,9 @@ TEST_F(AudioSendStreamCallTest, SendDtmf) {
|
|||
DtmfObserver() = default;
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
if (rtp_packet.PayloadType() == kDtmfPayloadType) {
|
||||
EXPECT_EQ(rtp_packet.headers_size(), 12u);
|
||||
|
|
|
@ -172,8 +172,9 @@ TEST_F(ChannelReceiveTest, ReceiveReportGeneratedOnTime) {
|
|||
|
||||
bool receiver_report_sent = false;
|
||||
EXPECT_CALL(transport_, SendRtcp)
|
||||
.WillRepeatedly([&](const uint8_t* packet, size_t length) {
|
||||
if (length >= 2 && packet[1] == rtcp::ReceiverReport::kPacketType) {
|
||||
.WillRepeatedly([&](rtc::ArrayView<const uint8_t> packet) {
|
||||
if (packet.size() >= 2 &&
|
||||
packet[1] == rtcp::ReceiverReport::kPacketType) {
|
||||
receiver_report_sent = true;
|
||||
}
|
||||
return true;
|
||||
|
@ -189,8 +190,8 @@ TEST_F(ChannelReceiveTest, CaptureStartTimeBecomesValid) {
|
|||
auto channel = CreateTestChannelReceive();
|
||||
|
||||
EXPECT_CALL(transport_, SendRtcp)
|
||||
.WillRepeatedly([&](const uint8_t* packet, size_t length) {
|
||||
HandleGeneratedRtcp(*channel, rtc::MakeArrayView(packet, length));
|
||||
.WillRepeatedly([&](rtc::ArrayView<const uint8_t> packet) {
|
||||
HandleGeneratedRtcp(*channel, packet);
|
||||
return true;
|
||||
});
|
||||
// Before any packets are sent, CaptureStartTime is invalid.
|
||||
|
|
|
@ -120,11 +120,11 @@ TEST_F(ChannelSendTest, IncreaseRtpTimestampByPauseDuration) {
|
|||
channel_->StartSend();
|
||||
uint32_t timestamp;
|
||||
int sent_packets = 0;
|
||||
auto send_rtp = [&](const uint8_t* data, size_t length,
|
||||
auto send_rtp = [&](rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) {
|
||||
++sent_packets;
|
||||
RtpPacketReceived packet;
|
||||
packet.Parse(data, length);
|
||||
packet.Parse(data);
|
||||
timestamp = packet.Timestamp();
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -104,9 +104,8 @@ class AudioChannelTest : public ::testing::Test {
|
|||
// Resulted RTP packet is looped back into AudioChannel and gets decoded into
|
||||
// audio frame to see if it has some signal to indicate its validity.
|
||||
TEST_F(AudioChannelTest, PlayRtpByLocalLoop) {
|
||||
auto loop_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
audio_channel_->ReceivedRTPPacket(
|
||||
rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto loop_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
audio_channel_->ReceivedRTPPacket(packet);
|
||||
return true;
|
||||
};
|
||||
EXPECT_CALL(transport_, SendRtp).WillOnce(Invoke(loop_rtp));
|
||||
|
@ -130,8 +129,8 @@ TEST_F(AudioChannelTest, PlayRtpByLocalLoop) {
|
|||
// Validate assigned local SSRC is resulted in RTP packet.
|
||||
TEST_F(AudioChannelTest, VerifyLocalSsrcAsAssigned) {
|
||||
RtpPacketReceived rtp;
|
||||
auto loop_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
rtp.Parse(packet, length);
|
||||
auto loop_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
rtp.Parse(packet);
|
||||
return true;
|
||||
};
|
||||
EXPECT_CALL(transport_, SendRtp).WillOnce(Invoke(loop_rtp));
|
||||
|
@ -145,9 +144,8 @@ TEST_F(AudioChannelTest, VerifyLocalSsrcAsAssigned) {
|
|||
|
||||
// Check metrics after processing an RTP packet.
|
||||
TEST_F(AudioChannelTest, TestIngressStatistics) {
|
||||
auto loop_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
audio_channel_->ReceivedRTPPacket(
|
||||
rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto loop_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
audio_channel_->ReceivedRTPPacket(packet);
|
||||
return true;
|
||||
};
|
||||
EXPECT_CALL(transport_, SendRtp).WillRepeatedly(Invoke(loop_rtp));
|
||||
|
@ -223,14 +221,12 @@ TEST_F(AudioChannelTest, TestIngressStatistics) {
|
|||
|
||||
// Check ChannelStatistics metric after processing RTP and RTCP packets.
|
||||
TEST_F(AudioChannelTest, TestChannelStatistics) {
|
||||
auto loop_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
audio_channel_->ReceivedRTPPacket(
|
||||
rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto loop_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
audio_channel_->ReceivedRTPPacket(packet);
|
||||
return true;
|
||||
};
|
||||
auto loop_rtcp = [&](const uint8_t* packet, size_t length) {
|
||||
audio_channel_->ReceivedRTCPPacket(
|
||||
rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto loop_rtcp = [&](rtc::ArrayView<const uint8_t> packet) {
|
||||
audio_channel_->ReceivedRTCPPacket(packet);
|
||||
return true;
|
||||
};
|
||||
EXPECT_CALL(transport_, SendRtp).WillRepeatedly(Invoke(loop_rtp));
|
||||
|
@ -294,8 +290,8 @@ TEST_F(AudioChannelTest, RttIsAvailableAfterChangeOfRemoteSsrc) {
|
|||
auto send_recv_rtp = [&](rtc::scoped_refptr<AudioChannel> rtp_sender,
|
||||
rtc::scoped_refptr<AudioChannel> rtp_receiver) {
|
||||
// Setup routing logic via transport_.
|
||||
auto route_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
rtp_receiver->ReceivedRTPPacket(rtc::MakeArrayView(packet, length));
|
||||
auto route_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
rtp_receiver->ReceivedRTPPacket(packet);
|
||||
return true;
|
||||
};
|
||||
ON_CALL(transport_, SendRtp).WillByDefault(route_rtp);
|
||||
|
@ -316,8 +312,8 @@ TEST_F(AudioChannelTest, RttIsAvailableAfterChangeOfRemoteSsrc) {
|
|||
auto send_recv_rtcp = [&](rtc::scoped_refptr<AudioChannel> rtcp_sender,
|
||||
rtc::scoped_refptr<AudioChannel> rtcp_receiver) {
|
||||
// Setup routing logic via transport_.
|
||||
auto route_rtcp = [&](const uint8_t* packet, size_t length) {
|
||||
rtcp_receiver->ReceivedRTCPPacket(rtc::MakeArrayView(packet, length));
|
||||
auto route_rtcp = [&](rtc::ArrayView<const uint8_t> packet) {
|
||||
rtcp_receiver->ReceivedRTCPPacket(packet);
|
||||
return true;
|
||||
};
|
||||
ON_CALL(transport_, SendRtcp).WillByDefault(route_rtcp);
|
||||
|
|
|
@ -122,8 +122,8 @@ TEST_F(AudioEgressTest, ProcessAudioWithMute) {
|
|||
rtc::Event event;
|
||||
int rtp_count = 0;
|
||||
RtpPacketReceived rtp;
|
||||
auto rtp_sent = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
rtp.Parse(packet, length);
|
||||
auto rtp_sent = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
rtp.Parse(packet);
|
||||
if (++rtp_count == kExpected) {
|
||||
event.Set();
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ TEST_F(AudioEgressTest, ProcessAudioWithSineWave) {
|
|||
rtc::Event event;
|
||||
int rtp_count = 0;
|
||||
RtpPacketReceived rtp;
|
||||
auto rtp_sent = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
rtp.Parse(packet, length);
|
||||
auto rtp_sent = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
rtp.Parse(packet);
|
||||
if (++rtp_count == kExpected) {
|
||||
event.Set();
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ TEST_F(AudioEgressTest, SkipAudioEncodingAfterStopSend) {
|
|||
constexpr int kExpected = 10;
|
||||
rtc::Event event;
|
||||
int rtp_count = 0;
|
||||
auto rtp_sent = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
auto rtp_sent = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
if (++rtp_count == kExpected) {
|
||||
event.Set();
|
||||
}
|
||||
|
@ -269,9 +269,9 @@ TEST_F(AudioEgressTest, SendDTMF) {
|
|||
// It's possible that we may have actual audio RTP packets along with
|
||||
// DTMF packtets. We are only interested in the exact number of DTMF
|
||||
// packets rtp stack is emitting.
|
||||
auto rtp_sent = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
auto rtp_sent = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
RtpPacketReceived rtp;
|
||||
rtp.Parse(packet, length);
|
||||
rtp.Parse(packet);
|
||||
if (is_dtmf(rtp) && ++dtmf_count == kExpected) {
|
||||
event.Set();
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ TEST_F(AudioEgressTest, TestAudioInputLevelAndEnergyDuration) {
|
|||
constexpr int kExpected = 6;
|
||||
rtc::Event event;
|
||||
int rtp_count = 0;
|
||||
auto rtp_sent = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
auto rtp_sent = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
if (++rtp_count == kExpected) {
|
||||
event.Set();
|
||||
}
|
||||
|
|
|
@ -114,8 +114,8 @@ TEST_F(AudioIngressTest, PlayingAfterStartAndStop) {
|
|||
|
||||
TEST_F(AudioIngressTest, GetAudioFrameAfterRtpReceived) {
|
||||
rtc::Event event;
|
||||
auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto handle_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
ingress_->ReceivedRTPPacket(packet);
|
||||
event.Set();
|
||||
return true;
|
||||
};
|
||||
|
@ -144,8 +144,8 @@ TEST_F(AudioIngressTest, TestSpeechOutputLevelAndEnergyDuration) {
|
|||
constexpr int kNumRtp = 6;
|
||||
int rtp_count = 0;
|
||||
rtc::Event event;
|
||||
auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto handle_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
ingress_->ReceivedRTPPacket(packet);
|
||||
if (++rtp_count == kNumRtp) {
|
||||
event.Set();
|
||||
}
|
||||
|
@ -175,8 +175,8 @@ TEST_F(AudioIngressTest, TestSpeechOutputLevelAndEnergyDuration) {
|
|||
|
||||
TEST_F(AudioIngressTest, PreferredSampleRate) {
|
||||
rtc::Event event;
|
||||
auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto handle_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
ingress_->ReceivedRTPPacket(packet);
|
||||
event.Set();
|
||||
return true;
|
||||
};
|
||||
|
@ -204,8 +204,8 @@ TEST_F(AudioIngressTest, GetMutedAudioFrameAfterRtpReceivedAndStopPlay) {
|
|||
constexpr int kNumRtp = 6;
|
||||
int rtp_count = 0;
|
||||
rtc::Event event;
|
||||
auto handle_rtp = [&](const uint8_t* packet, size_t length, Unused) {
|
||||
ingress_->ReceivedRTPPacket(rtc::ArrayView<const uint8_t>(packet, length));
|
||||
auto handle_rtp = [&](rtc::ArrayView<const uint8_t> packet, Unused) {
|
||||
ingress_->ReceivedRTPPacket(packet);
|
||||
if (++rtp_count == kNumRtp) {
|
||||
event.Set();
|
||||
}
|
||||
|
|
|
@ -469,10 +469,10 @@ void CallPerfTest::TestCaptureNtpTime(
|
|||
EXPECT_TRUE(std::abs(time_offset_ms) < threshold_ms_);
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
if (!rtp_start_timestamp_set_) {
|
||||
// Calculate the rtp timestamp offset in order to calculate the real
|
||||
|
@ -695,7 +695,7 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
|
|||
|
||||
private:
|
||||
// TODO(holmer): Run this with a timer instead of once per packet.
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
task_queue_->PostTask(SafeTask(task_safety_flag_, [this]() {
|
||||
VideoSendStream::Stats stats = send_stream_->GetStats();
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
|
|||
}
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
const Timestamp now = clock_->CurrentTime();
|
||||
if (now - last_getstats_time_ > kMinGetStatsInterval) {
|
||||
last_getstats_time_ = now;
|
||||
|
|
|
@ -31,18 +31,17 @@ DegradedCall::FakeNetworkPipeOnTaskQueue::FakeNetworkPipeOnTaskQueue(
|
|||
pipe_(clock, std::move(network_behavior)) {}
|
||||
|
||||
void DegradedCall::FakeNetworkPipeOnTaskQueue::SendRtp(
|
||||
const uint8_t* packet,
|
||||
size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options,
|
||||
Transport* transport) {
|
||||
pipe_.SendRtp(packet, length, options, transport);
|
||||
pipe_.SendRtp(packet, options, transport);
|
||||
Process();
|
||||
}
|
||||
|
||||
void DegradedCall::FakeNetworkPipeOnTaskQueue::SendRtcp(const uint8_t* packet,
|
||||
size_t length,
|
||||
Transport* transport) {
|
||||
pipe_.SendRtcp(packet, length, transport);
|
||||
void DegradedCall::FakeNetworkPipeOnTaskQueue::SendRtcp(
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
Transport* transport) {
|
||||
pipe_.SendRtcp(packet, transport);
|
||||
Process();
|
||||
}
|
||||
|
||||
|
@ -102,20 +101,19 @@ DegradedCall::FakeNetworkPipeTransportAdapter::
|
|||
}
|
||||
|
||||
bool DegradedCall::FakeNetworkPipeTransportAdapter::SendRtp(
|
||||
const uint8_t* packet,
|
||||
size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
// A call here comes from the RTP stack (probably pacer). We intercept it and
|
||||
// put it in the fake network pipe instead, but report to Call that is has
|
||||
// been sent, so that the bandwidth estimator sees the delay we add.
|
||||
network_pipe_->SendRtp(packet, length, options, real_transport_);
|
||||
network_pipe_->SendRtp(packet, options, real_transport_);
|
||||
if (options.packet_id != -1) {
|
||||
rtc::SentPacket sent_packet;
|
||||
sent_packet.packet_id = options.packet_id;
|
||||
sent_packet.send_time_ms = clock_->TimeInMilliseconds();
|
||||
sent_packet.info.included_in_feedback = options.included_in_feedback;
|
||||
sent_packet.info.included_in_allocation = options.included_in_allocation;
|
||||
sent_packet.info.packet_size_bytes = length;
|
||||
sent_packet.info.packet_size_bytes = packet.size();
|
||||
sent_packet.info.packet_type = rtc::PacketType::kData;
|
||||
call_->OnSentPacket(sent_packet);
|
||||
}
|
||||
|
@ -123,9 +121,8 @@ bool DegradedCall::FakeNetworkPipeTransportAdapter::SendRtp(
|
|||
}
|
||||
|
||||
bool DegradedCall::FakeNetworkPipeTransportAdapter::SendRtcp(
|
||||
const uint8_t* packet,
|
||||
size_t length) {
|
||||
network_pipe_->SendRtcp(packet, length, real_transport_);
|
||||
rtc::ArrayView<const uint8_t> packet) {
|
||||
network_pipe_->SendRtcp(packet, real_transport_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,11 +128,10 @@ class DegradedCall : public Call, private PacketReceiver {
|
|||
Clock* clock,
|
||||
std::unique_ptr<NetworkBehaviorInterface> network_behavior);
|
||||
|
||||
void SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
void SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options,
|
||||
Transport* transport);
|
||||
void SendRtcp(const uint8_t* packet, size_t length, Transport* transport);
|
||||
void SendRtcp(rtc::ArrayView<const uint8_t> packet, Transport* transport);
|
||||
|
||||
void AddActiveTransport(Transport* transport);
|
||||
void RemoveActiveTransport(Transport* transport);
|
||||
|
@ -161,10 +160,9 @@ class DegradedCall : public Call, private PacketReceiver {
|
|||
Transport* real_transport);
|
||||
~FakeNetworkPipeTransportAdapter();
|
||||
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override;
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
|
||||
|
||||
private:
|
||||
FakeNetworkPipeOnTaskQueue* const network_pipe_;
|
||||
|
|
|
@ -156,38 +156,33 @@ void FakeNetworkPipe::RemoveActiveTransport(Transport* transport) {
|
|||
}
|
||||
}
|
||||
|
||||
bool FakeNetworkPipe::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool FakeNetworkPipe::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RTC_DCHECK(global_transport_);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), options, false,
|
||||
global_transport_);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet.data(), packet.size()), options,
|
||||
false, global_transport_);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FakeNetworkPipe::SendRtcp(const uint8_t* packet, size_t length) {
|
||||
bool FakeNetworkPipe::SendRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
RTC_DCHECK(global_transport_);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), absl::nullopt, true,
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet), absl::nullopt, true,
|
||||
global_transport_);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FakeNetworkPipe::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool FakeNetworkPipe::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options,
|
||||
Transport* transport) {
|
||||
RTC_DCHECK(transport);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), options, false,
|
||||
transport);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet), options, false, transport);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FakeNetworkPipe::SendRtcp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool FakeNetworkPipe::SendRtcp(rtc::ArrayView<const uint8_t> packet,
|
||||
Transport* transport) {
|
||||
RTC_DCHECK(transport);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), absl::nullopt, true,
|
||||
transport);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet), absl::nullopt, true, transport);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,19 +138,17 @@ class FakeNetworkPipe : public SimulatedPacketReceiverInterface {
|
|||
// be passed to the transport instance given in SetReceiverTransport(). These
|
||||
// methods should only be called if a Transport instance was provided in the
|
||||
// constructor.
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options);
|
||||
bool SendRtcp(const uint8_t* packet, size_t length);
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet);
|
||||
|
||||
// Methods for use with Transport interface. When/if packets are delivered,
|
||||
// they will be passed to the instance specified by the `transport` parameter.
|
||||
// Note that that instance must be in the map of active transports.
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options,
|
||||
Transport* transport);
|
||||
bool SendRtcp(const uint8_t* packet, size_t length, Transport* transport);
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet, Transport* transport);
|
||||
|
||||
// Implements the PacketReceiver interface. When/if packets are delivered,
|
||||
// they will be passed directly to the receiver instance given in
|
||||
|
|
|
@ -464,10 +464,10 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
|
|||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.Times(2)
|
||||
.WillRepeatedly([&rtp_sequence_numbers, &transport_sequence_numbers](
|
||||
const uint8_t* packet, size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
rtp_sequence_numbers.push_back(rtp_packet.SequenceNumber());
|
||||
transport_sequence_numbers.push_back(options.packet_id);
|
||||
return true;
|
||||
|
@ -491,10 +491,10 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
|
|||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.Times(2)
|
||||
.WillRepeatedly([&retransmitted_rtp_sequence_numbers](
|
||||
const uint8_t* packet, size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
|
||||
// Capture the retransmitted sequence number from the RTX header.
|
||||
rtc::ArrayView<const uint8_t> payload = rtp_packet.payload();
|
||||
|
@ -532,10 +532,10 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
|
|||
// still be retransmitted.
|
||||
test.AdvanceTime(TimeDelta::Millis(33));
|
||||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.WillOnce([&lost_packet_feedback](const uint8_t* packet, size_t length,
|
||||
.WillOnce([&lost_packet_feedback](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
|
||||
// Capture the retransmitted sequence number from the RTX header.
|
||||
rtc::ArrayView<const uint8_t> payload = rtp_packet.payload();
|
||||
|
@ -635,10 +635,10 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
|
|||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.WillOnce(
|
||||
[&frame1_rtp_sequence_number, &frame1_transport_sequence_number](
|
||||
const uint8_t* packet, size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
frame1_rtp_sequence_number = rtp_packet.SequenceNumber();
|
||||
frame1_transport_sequence_number = options.packet_id;
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), kSsrc1);
|
||||
|
@ -655,10 +655,10 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
|
|||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.WillOnce(
|
||||
[&frame2_rtp_sequence_number, &frame2_transport_sequence_number](
|
||||
const uint8_t* packet, size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
frame2_rtp_sequence_number = rtp_packet.SequenceNumber();
|
||||
frame2_transport_sequence_number = options.packet_id;
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), kSsrc2);
|
||||
|
@ -673,11 +673,11 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
|
|||
// Inject a transport feedback where the packet for the first frame is lost,
|
||||
// expect a retransmission for it.
|
||||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.WillOnce([&frame1_rtp_sequence_number](const uint8_t* packet,
|
||||
size_t length,
|
||||
const PacketOptions& options) {
|
||||
.WillOnce([&frame1_rtp_sequence_number](
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
|
||||
|
||||
// Retransmitted sequence number from the RTX header should match
|
||||
|
@ -716,10 +716,10 @@ TEST(RtpVideoSenderTest, SupportsDependencyDescriptor) {
|
|||
kDependencyDescriptorExtensionId);
|
||||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault([&](const uint8_t* packet, size_t length,
|
||||
.WillByDefault([&](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
sent_packets.emplace_back(&extensions);
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet, length));
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -777,9 +777,8 @@ TEST(RtpVideoSenderTest,
|
|||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault(
|
||||
[&](const uint8_t* packet, size_t length, const PacketOptions&) {
|
||||
EXPECT_TRUE(
|
||||
sent_packets.emplace_back(&extensions).Parse(packet, length));
|
||||
[&](rtc::ArrayView<const uint8_t> packet, const PacketOptions&) {
|
||||
EXPECT_TRUE(sent_packets.emplace_back(&extensions).Parse(packet));
|
||||
return true;
|
||||
});
|
||||
test.SetActiveModules({true});
|
||||
|
@ -823,10 +822,10 @@ TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9) {
|
|||
kDependencyDescriptorExtensionId);
|
||||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault([&](const uint8_t* packet, size_t length,
|
||||
.WillByDefault([&](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
sent_packets.emplace_back(&extensions);
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet, length));
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -879,10 +878,10 @@ TEST(RtpVideoSenderTest,
|
|||
kDependencyDescriptorExtensionId);
|
||||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault([&](const uint8_t* packet, size_t length,
|
||||
.WillByDefault([&](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
sent_packets.emplace_back(&extensions);
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet, length));
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -934,10 +933,10 @@ TEST(RtpVideoSenderTest, GenerateDependecyDescriptorForGenericCodecs) {
|
|||
kDependencyDescriptorExtensionId);
|
||||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault([&](const uint8_t* packet, size_t length,
|
||||
.WillByDefault([&](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
sent_packets.emplace_back(&extensions);
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet, length));
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -980,10 +979,10 @@ TEST(RtpVideoSenderTest, SupportsStoppingUsingDependencyDescriptor) {
|
|||
kDependencyDescriptorExtensionId);
|
||||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault([&](const uint8_t* packet, size_t length,
|
||||
.WillByDefault([&](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
sent_packets.emplace_back(&extensions);
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet, length));
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -1092,10 +1091,10 @@ TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) {
|
|||
kDependencyDescriptorExtensionId);
|
||||
std::vector<RtpPacket> sent_packets;
|
||||
ON_CALL(test.transport(), SendRtp)
|
||||
.WillByDefault([&](const uint8_t* packet, size_t length,
|
||||
.WillByDefault([&](rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
sent_packets.emplace_back(&extensions);
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet, length));
|
||||
EXPECT_TRUE(sent_packets.back().Parse(packet));
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -1182,10 +1181,10 @@ TEST(RtpVideoSenderTest, RetransmitsBaseLayerOnly) {
|
|||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.Times(2)
|
||||
.WillRepeatedly([&rtp_sequence_numbers, &transport_sequence_numbers](
|
||||
const uint8_t* packet, size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
rtp_sequence_numbers.push_back(rtp_packet.SequenceNumber());
|
||||
transport_sequence_numbers.push_back(options.packet_id);
|
||||
return true;
|
||||
|
@ -1218,10 +1217,10 @@ TEST(RtpVideoSenderTest, RetransmitsBaseLayerOnly) {
|
|||
EXPECT_CALL(test.transport(), SendRtp)
|
||||
.Times(1)
|
||||
.WillRepeatedly([&retransmitted_rtp_sequence_numbers](
|
||||
const uint8_t* packet, size_t length,
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
|
||||
// Capture the retransmitted sequence number from the RTX header.
|
||||
rtc::ArrayView<const uint8_t> payload = rtp_packet.payload();
|
||||
|
|
|
@ -199,11 +199,6 @@ MediaChannelUtil::TransportForMediaChannels::~TransportForMediaChannels() {
|
|||
RTC_DCHECK(!network_interface_);
|
||||
}
|
||||
|
||||
bool MediaChannelUtil::TransportForMediaChannels::SendRtcp(const uint8_t* data,
|
||||
size_t len) {
|
||||
return SendRtcp(rtc::MakeArrayView(data, len));
|
||||
}
|
||||
|
||||
bool MediaChannelUtil::TransportForMediaChannels::SendRtcp(
|
||||
rtc::ArrayView<const uint8_t> packet) {
|
||||
auto send = [this, packet = rtc::CopyOnWriteBuffer(
|
||||
|
@ -223,13 +218,6 @@ bool MediaChannelUtil::TransportForMediaChannels::SendRtcp(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool MediaChannelUtil::TransportForMediaChannels::SendRtp(
|
||||
const uint8_t* data,
|
||||
size_t len,
|
||||
const webrtc::PacketOptions& options) {
|
||||
return SendRtp(rtc::ArrayView<const uint8_t>(data, len), options);
|
||||
}
|
||||
|
||||
bool MediaChannelUtil::TransportForMediaChannels::SendRtp(
|
||||
rtc::ArrayView<const uint8_t> packet,
|
||||
const webrtc::PacketOptions& options) {
|
||||
|
|
|
@ -136,10 +136,6 @@ class MediaChannelUtil {
|
|||
virtual ~TransportForMediaChannels();
|
||||
|
||||
// Implementation of webrtc::Transport
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
const webrtc::PacketOptions& options) override;
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override;
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const webrtc::PacketOptions& options) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
|
||||
|
|
|
@ -930,11 +930,11 @@ TEST_F(WebRtcVideoEngineTest, SendsFeedbackAfterUnsignaledRtxPacket) {
|
|||
MockNetworkInterface network;
|
||||
RtcpPacketParser rtcp_parser;
|
||||
ON_CALL(network, SendRtcp)
|
||||
.WillByDefault(testing::DoAll(
|
||||
WithArg<0>([&](rtc::CopyOnWriteBuffer* packet) {
|
||||
ASSERT_TRUE(rtcp_parser.Parse(packet->cdata(), packet->size()));
|
||||
}),
|
||||
Return(true)));
|
||||
.WillByDefault(
|
||||
testing::DoAll(WithArg<0>([&](rtc::CopyOnWriteBuffer* packet) {
|
||||
ASSERT_TRUE(rtcp_parser.Parse(*packet));
|
||||
}),
|
||||
Return(true)));
|
||||
std::unique_ptr<VideoMediaSendChannelInterface> send_channel =
|
||||
engine_.CreateSendChannel(call_.get(), GetMediaConfig(), VideoOptions(),
|
||||
webrtc::CryptoOptions(),
|
||||
|
|
|
@ -76,12 +76,11 @@ class RtxLoopBackTransport : public webrtc::Transport {
|
|||
packet_loss_ = 0;
|
||||
}
|
||||
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t len,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override {
|
||||
count_++;
|
||||
RtpPacketReceived packet;
|
||||
if (!packet.Parse(data, len))
|
||||
if (!packet.Parse(data))
|
||||
return false;
|
||||
if (packet.Ssrc() == rtx_ssrc_) {
|
||||
count_rtx_ssrc_++;
|
||||
|
@ -102,8 +101,8 @@ class RtxLoopBackTransport : public webrtc::Transport {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SendRtcp(const uint8_t* data, size_t len) override {
|
||||
module_->IncomingRtcpPacket(rtc::MakeArrayView((const uint8_t*)data, len));
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
module_->IncomingRtcpPacket(data);
|
||||
return true;
|
||||
}
|
||||
int count_;
|
||||
|
|
|
@ -52,7 +52,7 @@ TEST(RtcpCompoundPacketTest, AppendPacket) {
|
|||
|
||||
rtc::Buffer packet = compound.Build();
|
||||
RtcpPacketParser parser;
|
||||
parser.Parse(packet.data(), packet.size());
|
||||
parser.Parse(packet);
|
||||
EXPECT_EQ(1, parser.receiver_report()->num_packets());
|
||||
EXPECT_EQ(kSenderSsrc, parser.receiver_report()->sender_ssrc());
|
||||
EXPECT_EQ(1u, parser.receiver_report()->report_blocks().size());
|
||||
|
@ -80,7 +80,7 @@ TEST(RtcpCompoundPacketTest, AppendPacketWithOwnAppendedPacket) {
|
|||
|
||||
rtc::Buffer packet = root.Build();
|
||||
RtcpPacketParser parser;
|
||||
parser.Parse(packet.data(), packet.size());
|
||||
parser.Parse(packet);
|
||||
EXPECT_EQ(1, parser.sender_report()->num_packets());
|
||||
EXPECT_EQ(1, parser.receiver_report()->num_packets());
|
||||
EXPECT_EQ(1u, parser.receiver_report()->report_blocks().size());
|
||||
|
@ -108,7 +108,7 @@ TEST(RtcpCompoundPacketTest, BuildWithInputBuffer) {
|
|||
EXPECT_CALL(callback, Call(_))
|
||||
.WillOnce(Invoke([&](rtc::ArrayView<const uint8_t> packet) {
|
||||
RtcpPacketParser parser;
|
||||
parser.Parse(packet.data(), packet.size());
|
||||
parser.Parse(packet);
|
||||
EXPECT_EQ(1, parser.receiver_report()->num_packets());
|
||||
EXPECT_EQ(1u, parser.receiver_report()->report_blocks().size());
|
||||
EXPECT_EQ(1, parser.fir()->num_packets());
|
||||
|
@ -136,14 +136,14 @@ TEST(RtcpCompoundPacketTest, BuildWithTooSmallBuffer_FragmentedSend) {
|
|||
EXPECT_CALL(callback, Call(_))
|
||||
.WillOnce(Invoke([&](rtc::ArrayView<const uint8_t> packet) {
|
||||
RtcpPacketParser parser;
|
||||
parser.Parse(packet.data(), packet.size());
|
||||
parser.Parse(packet);
|
||||
EXPECT_EQ(1, parser.receiver_report()->num_packets());
|
||||
EXPECT_EQ(1U, parser.receiver_report()->report_blocks().size());
|
||||
EXPECT_EQ(0, parser.fir()->num_packets());
|
||||
}))
|
||||
.WillOnce(Invoke([&](rtc::ArrayView<const uint8_t> packet) {
|
||||
RtcpPacketParser parser;
|
||||
parser.Parse(packet.data(), packet.size());
|
||||
parser.Parse(packet);
|
||||
EXPECT_EQ(0, parser.receiver_report()->num_packets());
|
||||
EXPECT_EQ(0U, parser.receiver_report()->report_blocks().size());
|
||||
EXPECT_EQ(1, parser.fir()->num_packets());
|
||||
|
|
|
@ -54,13 +54,12 @@ class TestTransport : public Transport {
|
|||
public:
|
||||
TestTransport() {}
|
||||
|
||||
bool SendRtp(const uint8_t* /*data*/,
|
||||
size_t /*len*/,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> /*data*/,
|
||||
const PacketOptions& options) override {
|
||||
return false;
|
||||
}
|
||||
bool SendRtcp(const uint8_t* data, size_t len) override {
|
||||
parser_.Parse(data, len);
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
parser_.Parse(data);
|
||||
return true;
|
||||
}
|
||||
test::RtcpPacketParser parser_;
|
||||
|
@ -665,10 +664,10 @@ TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) {
|
|||
// of a RTCP compound packet.
|
||||
TEST_F(RtcpSenderTest, ByeMustBeLast) {
|
||||
MockTransport mock_transport;
|
||||
EXPECT_CALL(mock_transport, SendRtcp(_, _))
|
||||
.WillOnce(Invoke([](const uint8_t* data, size_t len) {
|
||||
const uint8_t* next_packet = data;
|
||||
const uint8_t* const packet_end = data + len;
|
||||
EXPECT_CALL(mock_transport, SendRtcp(_))
|
||||
.WillOnce(Invoke([](rtc::ArrayView<const uint8_t> data) {
|
||||
const uint8_t* next_packet = data.data();
|
||||
const uint8_t* const packet_end = data.data() + data.size();
|
||||
rtcp::CommonHeader packet;
|
||||
while (next_packet < packet_end) {
|
||||
EXPECT_TRUE(packet.Parse(next_packet, packet_end - next_packet));
|
||||
|
|
|
@ -130,7 +130,7 @@ class FakeRtcpTransport {
|
|||
std::function<void(rtc::ArrayView<const uint8_t>)> RtcpParserTransport(
|
||||
RtcpPacketParser& parser) {
|
||||
return [&parser](rtc::ArrayView<const uint8_t> packet) {
|
||||
return parser.Parse(packet.data(), packet.size());
|
||||
return parser.Parse(packet);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ TEST(RtcpTransceiverTest, SendsCombinedRtcpPacketOnTaskQueue) {
|
|||
.WillOnce([&](rtc::ArrayView<const uint8_t> buffer) {
|
||||
EXPECT_TRUE(queue.IsCurrent());
|
||||
RtcpPacketParser rtcp_parser;
|
||||
rtcp_parser.Parse(buffer.data(), buffer.size());
|
||||
rtcp_parser.Parse(buffer);
|
||||
EXPECT_EQ(rtcp_parser.transport_feedback()->num_packets(), 1);
|
||||
EXPECT_EQ(rtcp_parser.transport_feedback()->sender_ssrc(), kSenderSsrc);
|
||||
EXPECT_EQ(rtcp_parser.app()->num_packets(), 1);
|
||||
|
@ -336,7 +336,7 @@ TEST(RtcpTransceiverTest, SendFrameIntraRequestDefaultsToNewRequest) {
|
|||
.WillOnce([&](rtc::ArrayView<const uint8_t> buffer) {
|
||||
EXPECT_TRUE(queue.IsCurrent());
|
||||
RtcpPacketParser rtcp_parser;
|
||||
rtcp_parser.Parse(buffer.data(), buffer.size());
|
||||
rtcp_parser.Parse(buffer);
|
||||
EXPECT_EQ(rtcp_parser.fir()->requests()[0].ssrc, kSenderSsrc);
|
||||
first_seq_nr = rtcp_parser.fir()->requests()[0].seq_nr;
|
||||
return true;
|
||||
|
@ -344,7 +344,7 @@ TEST(RtcpTransceiverTest, SendFrameIntraRequestDefaultsToNewRequest) {
|
|||
.WillOnce([&](rtc::ArrayView<const uint8_t> buffer) {
|
||||
EXPECT_TRUE(queue.IsCurrent());
|
||||
RtcpPacketParser rtcp_parser;
|
||||
rtcp_parser.Parse(buffer.data(), buffer.size());
|
||||
rtcp_parser.Parse(buffer);
|
||||
EXPECT_EQ(rtcp_parser.fir()->requests()[0].ssrc, kSenderSsrc);
|
||||
EXPECT_EQ(rtcp_parser.fir()->requests()[0].seq_nr, first_seq_nr + 1);
|
||||
return true;
|
||||
|
|
|
@ -102,21 +102,20 @@ class SendTransport : public Transport,
|
|||
|
||||
void SetRtpRtcpModule(ModuleRtpRtcpImpl2* receiver) { receiver_ = receiver; }
|
||||
void SimulateNetworkDelay(TimeDelta delay) { delay_ = delay; }
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t len,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override {
|
||||
EXPECT_TRUE(last_packet_.Parse(data, len));
|
||||
EXPECT_TRUE(last_packet_.Parse(data));
|
||||
++rtp_packets_sent_;
|
||||
return true;
|
||||
}
|
||||
bool SendRtcp(const uint8_t* data, size_t len) override {
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
test::RtcpPacketParser parser;
|
||||
parser.Parse(data, len);
|
||||
parser.Parse(data);
|
||||
last_nack_list_ = parser.nack()->packet_ids();
|
||||
Timestamp current_time = time_controller_->GetClock()->CurrentTime();
|
||||
Timestamp delivery_time = current_time + delay_;
|
||||
rtcp_packets_.push_back(
|
||||
Packet{delivery_time, std::vector<uint8_t>(data, data + len)});
|
||||
Packet{delivery_time, std::vector<uint8_t>(data.begin(), data.end())});
|
||||
++rtcp_packets_sent_;
|
||||
RunReady(current_time);
|
||||
return true;
|
||||
|
|
|
@ -76,25 +76,24 @@ class SendTransport : public Transport {
|
|||
clock_ = clock;
|
||||
delay_ms_ = delay_ms;
|
||||
}
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t len,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override {
|
||||
RtpPacket packet;
|
||||
EXPECT_TRUE(packet.Parse(data, len));
|
||||
EXPECT_TRUE(packet.Parse(data));
|
||||
++rtp_packets_sent_;
|
||||
last_rtp_sequence_number_ = packet.SequenceNumber();
|
||||
return true;
|
||||
}
|
||||
bool SendRtcp(const uint8_t* data, size_t len) override {
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
test::RtcpPacketParser parser;
|
||||
parser.Parse(data, len);
|
||||
parser.Parse(data);
|
||||
last_nack_list_ = parser.nack()->packet_ids();
|
||||
|
||||
if (clock_) {
|
||||
clock_->AdvanceTimeMilliseconds(delay_ms_);
|
||||
}
|
||||
EXPECT_TRUE(receiver_);
|
||||
receiver_->IncomingRtcpPacket(rtc::MakeArrayView(data, len));
|
||||
receiver_->IncomingRtcpPacket(data);
|
||||
++rtcp_packets_sent_;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -45,14 +45,13 @@ class LoopbackTransportTest : public webrtc::Transport {
|
|||
kAbsoluteCaptureTimeExtensionId);
|
||||
}
|
||||
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t len,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& /*options*/) override {
|
||||
sent_packets_.push_back(RtpPacketReceived(&receivers_extensions_));
|
||||
EXPECT_TRUE(sent_packets_.back().Parse(data, len));
|
||||
EXPECT_TRUE(sent_packets_.back().Parse(data));
|
||||
return true;
|
||||
}
|
||||
bool SendRtcp(const uint8_t* data, size_t len) override { return false; }
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override { return false; }
|
||||
const RtpPacketReceived& last_sent_packet() { return sent_packets_.back(); }
|
||||
int packets_sent() { return sent_packets_.size(); }
|
||||
|
||||
|
|
|
@ -94,17 +94,17 @@ class TestTransport : public Transport {
|
|||
explicit TestTransport(RtpHeaderExtensionMap* extensions)
|
||||
: total_data_sent_(DataSize::Zero()), extensions_(extensions) {}
|
||||
MOCK_METHOD(void, SentRtp, (const PacketOptions& options), ());
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override {
|
||||
total_data_sent_ += DataSize::Bytes(length);
|
||||
last_packet_.emplace(rtc::MakeArrayView(packet, length), options,
|
||||
extensions_);
|
||||
total_data_sent_ += DataSize::Bytes(packet.size());
|
||||
last_packet_.emplace(packet, options, extensions_);
|
||||
SentRtp(options);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SendRtcp(const uint8_t*, size_t) override { RTC_CHECK_NOTREACHED(); }
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t>) override {
|
||||
RTC_CHECK_NOTREACHED();
|
||||
}
|
||||
|
||||
absl::optional<TransmittedPacket> last_packet() { return last_packet_; }
|
||||
|
||||
|
|
|
@ -113,14 +113,13 @@ class LoopbackTransportTest : public webrtc::Transport {
|
|||
kVideoLayersAllocationExtensionId);
|
||||
}
|
||||
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t len,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override {
|
||||
sent_packets_.push_back(RtpPacketReceived(&receivers_extensions_));
|
||||
EXPECT_TRUE(sent_packets_.back().Parse(data, len));
|
||||
EXPECT_TRUE(sent_packets_.back().Parse(data));
|
||||
return true;
|
||||
}
|
||||
bool SendRtcp(const uint8_t* data, size_t len) override { return false; }
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override { return false; }
|
||||
const RtpPacketReceived& last_sent_packet() { return sent_packets_.back(); }
|
||||
int packets_sent() { return sent_packets_.size(); }
|
||||
const std::vector<RtpPacketReceived>& sent_packets() const {
|
||||
|
|
|
@ -287,16 +287,15 @@ void RtpGenerator::GenerateRtpDump(const std::string& rtp_dump_path) {
|
|||
webrtc::kNetworkDown);
|
||||
}
|
||||
|
||||
bool RtpGenerator::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool RtpGenerator::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const webrtc::PacketOptions& options) {
|
||||
test::RtpPacket rtp_packet = DataToRtpPacket(packet, length);
|
||||
test::RtpPacket rtp_packet = DataToRtpPacket(packet.data(), packet.size());
|
||||
rtp_dump_writer_->WritePacket(&rtp_packet);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RtpGenerator::SendRtcp(const uint8_t* packet, size_t length) {
|
||||
test::RtpPacket rtcp_packet = DataToRtpPacket(packet, length);
|
||||
bool RtpGenerator::SendRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
test::RtpPacket rtcp_packet = DataToRtpPacket(packet.data(), packet.size());
|
||||
rtp_dump_writer_->WritePacket(&rtcp_packet);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -92,11 +92,10 @@ class RtpGenerator final : public webrtc::Transport {
|
|||
// webrtc::Transport implementation
|
||||
// Captured RTP packets are written to the RTPDump file instead of over the
|
||||
// network.
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const webrtc::PacketOptions& options) override;
|
||||
// RTCP packets are ignored for now.
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
|
||||
// Returns the maximum duration
|
||||
int GetMaxDuration() const;
|
||||
// Waits until all video streams have finished.
|
||||
|
|
|
@ -64,21 +64,20 @@ void DirectTransport::SetReceiver(PacketReceiver* receiver) {
|
|||
fake_network_->SetReceiver(receiver);
|
||||
}
|
||||
|
||||
bool DirectTransport::SendRtp(const uint8_t* data,
|
||||
size_t length,
|
||||
bool DirectTransport::SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) {
|
||||
if (send_call_) {
|
||||
rtc::SentPacket sent_packet(options.packet_id, rtc::TimeMillis());
|
||||
sent_packet.info.included_in_feedback = options.included_in_feedback;
|
||||
sent_packet.info.included_in_allocation = options.included_in_allocation;
|
||||
sent_packet.info.packet_size_bytes = length;
|
||||
sent_packet.info.packet_size_bytes = data.size();
|
||||
sent_packet.info.packet_type = rtc::PacketType::kData;
|
||||
send_call_->OnSentPacket(sent_packet);
|
||||
}
|
||||
|
||||
const RtpHeaderExtensionMap* extensions = nullptr;
|
||||
MediaType media_type = demuxer_.GetMediaType(data, length);
|
||||
switch (demuxer_.GetMediaType(data, length)) {
|
||||
MediaType media_type = demuxer_.GetMediaType(data.data(), data.size());
|
||||
switch (demuxer_.GetMediaType(data.data(), data.size())) {
|
||||
case webrtc::MediaType::AUDIO:
|
||||
extensions = &audio_extensions_;
|
||||
break;
|
||||
|
@ -92,7 +91,7 @@ bool DirectTransport::SendRtp(const uint8_t* data,
|
|||
if (media_type == MediaType::VIDEO) {
|
||||
packet.set_payload_type_frequency(kVideoPayloadTypeFrequency);
|
||||
}
|
||||
RTC_CHECK(packet.Parse(rtc::CopyOnWriteBuffer(data, length)));
|
||||
RTC_CHECK(packet.Parse(rtc::CopyOnWriteBuffer(data)));
|
||||
fake_network_->DeliverRtpPacket(
|
||||
media_type, std::move(packet),
|
||||
[](const RtpPacketReceived& packet) { return false; });
|
||||
|
@ -103,8 +102,8 @@ bool DirectTransport::SendRtp(const uint8_t* data,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DirectTransport::SendRtcp(const uint8_t* data, size_t length) {
|
||||
fake_network_->DeliverRtcpPacket(rtc::CopyOnWriteBuffer(data, length));
|
||||
bool DirectTransport::SendRtcp(rtc::ArrayView<const uint8_t> data) {
|
||||
fake_network_->DeliverRtcpPacket(rtc::CopyOnWriteBuffer(data));
|
||||
MutexLock lock(&process_lock_);
|
||||
if (!next_process_task_.Running())
|
||||
ProcessPackets();
|
||||
|
|
|
@ -56,10 +56,14 @@ class DirectTransport : public Transport {
|
|||
// TODO(holmer): Look into moving this to the constructor.
|
||||
virtual void SetReceiver(PacketReceiver* receiver);
|
||||
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t length,
|
||||
// Backwards compatibility using statements.
|
||||
// TODO(https://bugs.webrtc.org/15410): Remove when not needed.
|
||||
using Transport::SendRtcp;
|
||||
using Transport::SendRtp;
|
||||
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override;
|
||||
bool SendRtcp(const uint8_t* data, size_t length) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> data) override;
|
||||
|
||||
int GetAverageDelayMs();
|
||||
|
||||
|
|
|
@ -86,21 +86,20 @@ bool LayerFilteringTransport::DiscardedLastPacket() const {
|
|||
return discarded_last_packet_;
|
||||
}
|
||||
|
||||
bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool LayerFilteringTransport::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
if (selected_tl_ == -1 && selected_sl_ == -1) {
|
||||
// Nothing to change, forward the packet immediately.
|
||||
return test::DirectTransport::SendRtp(packet, length, options);
|
||||
return test::DirectTransport::SendRtp(packet, options);
|
||||
}
|
||||
|
||||
RtpPacket rtp_packet;
|
||||
rtp_packet.Parse(packet, length);
|
||||
rtp_packet.Parse(packet);
|
||||
|
||||
if (rtp_packet.Ssrc() < ssrc_to_filter_min_ ||
|
||||
rtp_packet.Ssrc() > ssrc_to_filter_max_) {
|
||||
// Nothing to change, forward the packet immediately.
|
||||
return test::DirectTransport::SendRtp(packet, length, options);
|
||||
return test::DirectTransport::SendRtp(packet, options);
|
||||
}
|
||||
|
||||
if (rtp_packet.PayloadType() == vp8_video_payload_type_ ||
|
||||
|
@ -178,8 +177,7 @@ bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
|
|||
}
|
||||
}
|
||||
|
||||
return test::DirectTransport::SendRtp(rtp_packet.data(), rtp_packet.size(),
|
||||
options);
|
||||
return test::DirectTransport::SendRtp(rtp_packet, options);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
|
|
@ -54,8 +54,7 @@ class LayerFilteringTransport : public test::DirectTransport {
|
|||
rtc::ArrayView<const RtpExtension> audio_extensions,
|
||||
rtc::ArrayView<const RtpExtension> video_extensions);
|
||||
bool DiscardedLastPacket() const;
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -23,9 +23,9 @@ class MockTransport : public Transport {
|
|||
|
||||
MOCK_METHOD(bool,
|
||||
SendRtp,
|
||||
(const uint8_t*, size_t, const PacketOptions&),
|
||||
(rtc::ArrayView<const uint8_t>, const PacketOptions&),
|
||||
(override));
|
||||
MOCK_METHOD(bool, SendRtcp, (const uint8_t*, size_t len), (override));
|
||||
MOCK_METHOD(bool, SendRtcp, (rtc::ArrayView<const uint8_t>), (override));
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -12,13 +12,12 @@
|
|||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
bool NullTransport::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool NullTransport::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NullTransport::SendRtcp(const uint8_t* packet, size_t length) {
|
||||
bool NullTransport::SendRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,9 @@ class PacketReceiver;
|
|||
namespace test {
|
||||
class NullTransport : public Transport {
|
||||
public:
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override;
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -21,11 +21,11 @@ namespace test {
|
|||
RtcpPacketParser::RtcpPacketParser() = default;
|
||||
RtcpPacketParser::~RtcpPacketParser() = default;
|
||||
|
||||
bool RtcpPacketParser::Parse(const void* data, size_t length) {
|
||||
bool RtcpPacketParser::Parse(rtc::ArrayView<const uint8_t> data) {
|
||||
++processed_rtcp_packets_;
|
||||
|
||||
const uint8_t* const buffer = static_cast<const uint8_t*>(data);
|
||||
const uint8_t* const buffer_end = buffer + length;
|
||||
const uint8_t* const buffer = data.data();
|
||||
const uint8_t* const buffer_end = buffer + data.size();
|
||||
|
||||
rtcp::CommonHeader header;
|
||||
for (const uint8_t* next_packet = buffer; next_packet != buffer_end;
|
||||
|
|
|
@ -79,7 +79,7 @@ class RtcpPacketParser {
|
|||
RtcpPacketParser();
|
||||
~RtcpPacketParser();
|
||||
|
||||
bool Parse(const void* packet, size_t packet_len);
|
||||
bool Parse(rtc::ArrayView<const uint8_t> packet);
|
||||
|
||||
PacketCounter<rtcp::App>* app() { return &app_; }
|
||||
PacketCounter<rtcp::Bye>* bye() { return &bye_; }
|
||||
|
|
|
@ -52,19 +52,19 @@ class RtpRtcpObserver {
|
|||
return observation_complete_.Wait(timeout_);
|
||||
}
|
||||
|
||||
virtual Action OnSendRtp(const uint8_t* packet, size_t length) {
|
||||
virtual Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) {
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
virtual Action OnSendRtcp(const uint8_t* packet, size_t length) {
|
||||
virtual Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
virtual Action OnReceiveRtp(const uint8_t* packet, size_t length) {
|
||||
virtual Action OnReceiveRtp(rtc::ArrayView<const uint8_t> packet) {
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
virtual Action OnReceiveRtcp(const uint8_t* packet, size_t length) {
|
||||
virtual Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
|
@ -100,16 +100,15 @@ class PacketTransport : public test::DirectTransport {
|
|||
transport_type_(transport_type) {}
|
||||
|
||||
private:
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override {
|
||||
EXPECT_TRUE(IsRtpPacket(rtc::MakeArrayView(packet, length)));
|
||||
EXPECT_TRUE(IsRtpPacket(packet));
|
||||
RtpRtcpObserver::Action action = RtpRtcpObserver::SEND_PACKET;
|
||||
if (observer_) {
|
||||
if (transport_type_ == kSender) {
|
||||
action = observer_->OnSendRtp(packet, length);
|
||||
action = observer_->OnSendRtp(packet);
|
||||
} else {
|
||||
action = observer_->OnReceiveRtp(packet, length);
|
||||
action = observer_->OnReceiveRtp(packet);
|
||||
}
|
||||
}
|
||||
switch (action) {
|
||||
|
@ -117,19 +116,19 @@ class PacketTransport : public test::DirectTransport {
|
|||
// Drop packet silently.
|
||||
return true;
|
||||
case RtpRtcpObserver::SEND_PACKET:
|
||||
return test::DirectTransport::SendRtp(packet, length, options);
|
||||
return test::DirectTransport::SendRtp(packet, options);
|
||||
}
|
||||
return true; // Will never happen, makes compiler happy.
|
||||
}
|
||||
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override {
|
||||
EXPECT_TRUE(IsRtcpPacket(rtc::MakeArrayView(packet, length)));
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
EXPECT_TRUE(IsRtcpPacket(packet));
|
||||
RtpRtcpObserver::Action action = RtpRtcpObserver::SEND_PACKET;
|
||||
if (observer_) {
|
||||
if (transport_type_ == kSender) {
|
||||
action = observer_->OnSendRtcp(packet, length);
|
||||
action = observer_->OnSendRtcp(packet);
|
||||
} else {
|
||||
action = observer_->OnReceiveRtcp(packet, length);
|
||||
action = observer_->OnReceiveRtcp(packet);
|
||||
}
|
||||
}
|
||||
switch (action) {
|
||||
|
@ -137,7 +136,7 @@ class PacketTransport : public test::DirectTransport {
|
|||
// Drop packet silently.
|
||||
return true;
|
||||
case RtpRtcpObserver::SEND_PACKET:
|
||||
return test::DirectTransport::SendRtcp(packet, length);
|
||||
return test::DirectTransport::SendRtcp(packet);
|
||||
}
|
||||
return true; // Will never happen, makes compiler happy.
|
||||
}
|
||||
|
|
|
@ -72,8 +72,7 @@ NetworkNodeTransport::NetworkNodeTransport(Clock* sender_clock,
|
|||
|
||||
NetworkNodeTransport::~NetworkNodeTransport() = default;
|
||||
|
||||
bool NetworkNodeTransport::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool NetworkNodeTransport::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
int64_t send_time_ms = sender_clock_->TimeInMilliseconds();
|
||||
rtc::SentPacket sent_packet;
|
||||
|
@ -81,21 +80,21 @@ bool NetworkNodeTransport::SendRtp(const uint8_t* packet,
|
|||
sent_packet.info.included_in_feedback = options.included_in_feedback;
|
||||
sent_packet.info.included_in_allocation = options.included_in_allocation;
|
||||
sent_packet.send_time_ms = send_time_ms;
|
||||
sent_packet.info.packet_size_bytes = length;
|
||||
sent_packet.info.packet_size_bytes = packet.size();
|
||||
sent_packet.info.packet_type = rtc::PacketType::kData;
|
||||
sender_call_->OnSentPacket(sent_packet);
|
||||
|
||||
MutexLock lock(&mutex_);
|
||||
if (!endpoint_)
|
||||
return false;
|
||||
rtc::CopyOnWriteBuffer buffer(packet, length);
|
||||
rtc::CopyOnWriteBuffer buffer(packet);
|
||||
endpoint_->SendPacket(local_address_, remote_address_, buffer,
|
||||
packet_overhead_.bytes());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetworkNodeTransport::SendRtcp(const uint8_t* packet, size_t length) {
|
||||
rtc::CopyOnWriteBuffer buffer(packet, length);
|
||||
bool NetworkNodeTransport::SendRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
rtc::CopyOnWriteBuffer buffer(packet);
|
||||
MutexLock lock(&mutex_);
|
||||
if (!endpoint_)
|
||||
return false;
|
||||
|
|
|
@ -53,10 +53,9 @@ class NetworkNodeTransport : public Transport {
|
|||
NetworkNodeTransport(Clock* sender_clock, Call* sender_call);
|
||||
~NetworkNodeTransport() override;
|
||||
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override;
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
|
||||
|
||||
void Connect(EmulatedEndpoint* endpoint,
|
||||
const rtc::SocketAddress& receiver_address,
|
||||
|
|
|
@ -58,9 +58,9 @@ TEST_F(BandwidthEndToEndTest, ReceiveStreamSendsRemb) {
|
|||
RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeExtensionId));
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
|
||||
if (parser.remb()->num_packets() > 0) {
|
||||
EXPECT_EQ(test::VideoTestConstants::kReceiverLocalVideoSsrc,
|
||||
|
@ -127,7 +127,7 @@ class BandwidthStatsTest : public test::EndToEndTest {
|
|||
}
|
||||
|
||||
// Called on the pacer thread.
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
// Stats need to be fetched on the thread where the caller objects were
|
||||
// constructed.
|
||||
task_queue_->PostTask([this]() {
|
||||
|
|
|
@ -83,10 +83,10 @@ class RtcpXrObserver : public test::EndToEndTest {
|
|||
|
||||
private:
|
||||
// Receive stream should send RR packets (and RRTR packets if enabled).
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
|
||||
sent_rtcp_rr_ += parser.receiver_report()->num_packets();
|
||||
EXPECT_EQ(0, parser.sender_report()->num_packets());
|
||||
|
@ -100,10 +100,10 @@ class RtcpXrObserver : public test::EndToEndTest {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
// Send stream should send SR packets (and DLRR packets if enabled).
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
|
||||
if (parser.sender_ssrc() == test::VideoTestConstants::kVideoSendSsrcs[1] &&
|
||||
enable_zero_target_bitrate_) {
|
||||
|
|
|
@ -60,10 +60,10 @@ TEST_F(FecEndToEndTest, ReceivesUlpfec) {
|
|||
num_packets_sent_(0) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_TRUE(rtp_packet.PayloadType() ==
|
||||
test::VideoTestConstants::kVideoSendPayloadType ||
|
||||
|
@ -182,10 +182,10 @@ class FlexfecRenderObserver : public test::EndToEndTest,
|
|||
size_t GetNumFlexfecStreams() const override { return 1; }
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_TRUE(
|
||||
rtp_packet.PayloadType() ==
|
||||
|
@ -255,10 +255,10 @@ class FlexfecRenderObserver : public test::EndToEndTest,
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* data, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
test::RtcpPacketParser parser;
|
||||
|
||||
parser.Parse(data, length);
|
||||
parser.Parse(data);
|
||||
if (parser.sender_ssrc() == kFlexfecLocalSsrc) {
|
||||
EXPECT_EQ(1, parser.receiver_report()->num_packets());
|
||||
const std::vector<rtcp::ReportBlock>& report_blocks =
|
||||
|
@ -375,10 +375,10 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
|
|||
encoder_factory_([]() { return VP8Encoder::Create(); }) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock_(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
int encapsulated_payload_type = -1;
|
||||
if (rtp_packet.PayloadType() ==
|
||||
|
@ -443,11 +443,11 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock_(&mutex_);
|
||||
if (state_ == kVerifyUlpfecPacketNotInNackList) {
|
||||
test::RtcpPacketParser rtcp_parser;
|
||||
rtcp_parser.Parse(packet, length);
|
||||
rtcp_parser.Parse(packet);
|
||||
const std::vector<uint16_t>& nacks = rtcp_parser.nack()->packet_ids();
|
||||
EXPECT_THAT(nacks, Not(Contains(ulpfec_sequence_number_)))
|
||||
<< "Got nack for ULPFEC packet";
|
||||
|
|
|
@ -66,7 +66,7 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
|
|||
}
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
if (MinMetricRunTimePassed() && MinNumberOfFramesReceived())
|
||||
observation_complete_.Set();
|
||||
|
||||
|
|
|
@ -76,11 +76,11 @@ class FrameObserver : public test::RtpRtcpObserver,
|
|||
|
||||
private:
|
||||
// Sends kFramesToObserve.
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
EXPECT_EQ(rtp_packet.Ssrc(), test::VideoTestConstants::kVideoSendSsrcs[0]);
|
||||
if (rtp_packet.payload_size() == 0)
|
||||
return SEND_PACKET; // Skip padding, may be sent after OnFrame is called.
|
||||
|
|
|
@ -36,14 +36,13 @@ class NetworkStateEndToEndTest : public test::CallTest {
|
|||
protected:
|
||||
class UnusedTransport : public Transport {
|
||||
private:
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override {
|
||||
ADD_FAILURE() << "Unexpected RTP sent.";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override {
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
ADD_FAILURE() << "Unexpected RTCP sent.";
|
||||
return false;
|
||||
}
|
||||
|
@ -62,15 +61,14 @@ class NetworkStateEndToEndTest : public test::CallTest {
|
|||
}
|
||||
|
||||
private:
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override {
|
||||
MutexLock lock(&mutex_);
|
||||
need_rtp_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override {
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
need_rtcp_ = false;
|
||||
return true;
|
||||
|
@ -174,10 +172,10 @@ TEST_F(NetworkStateEndToEndTest, RespectsNetworkState) {
|
|||
receiver_rtcp_(0),
|
||||
down_frames_(0) {}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&test_mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
if (rtp_packet.payload_size() == 0)
|
||||
++sender_padding_;
|
||||
++sender_rtp_;
|
||||
|
@ -185,19 +183,19 @@ TEST_F(NetworkStateEndToEndTest, RespectsNetworkState) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&test_mutex_);
|
||||
++sender_rtcp_;
|
||||
packet_event_.Set();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
ADD_FAILURE() << "Unexpected receiver RTP, should not be sending.";
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&test_mutex_);
|
||||
++receiver_rtcp_;
|
||||
packet_event_.Set();
|
||||
|
|
|
@ -60,10 +60,10 @@ TEST_F(RetransmissionEndToEndTest, ReceivesAndRetransmitsNack) {
|
|||
nacks_left_(kNumberOfNacksToObserve) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
// Never drop retransmitted packets.
|
||||
if (dropped_packets_.find(rtp_packet.SequenceNumber()) !=
|
||||
|
@ -97,10 +97,10 @@ TEST_F(RetransmissionEndToEndTest, ReceivesAndRetransmitsNack) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
nacks_left_ -= parser.nack()->num_packets();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
@ -145,9 +145,9 @@ TEST_F(RetransmissionEndToEndTest, ReceivesNackAndRetransmitsAudio) {
|
|||
size_t GetNumVideoStreams() const override { return 0; }
|
||||
size_t GetNumAudioStreams() const override { return 1; }
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
if (!sequence_number_to_retransmit_) {
|
||||
sequence_number_to_retransmit_ = rtp_packet.SequenceNumber();
|
||||
|
@ -212,9 +212,9 @@ TEST_F(RetransmissionEndToEndTest,
|
|||
receive_stream_ = receive_streams[0];
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
if (parser.pli()->num_packets() > 0)
|
||||
task_queue_->PostTask([this] { Run(); });
|
||||
return SEND_PACKET;
|
||||
|
@ -284,10 +284,10 @@ void RetransmissionEndToEndTest::ReceivesPliAndRecovers(int rtp_history_ms) {
|
|||
received_pli_(false) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
// Drop all retransmitted packets to force a PLI.
|
||||
if (rtp_packet.Timestamp() <= highest_dropped_timestamp_)
|
||||
|
@ -302,10 +302,10 @@ void RetransmissionEndToEndTest::ReceivesPliAndRecovers(int rtp_history_ms) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
if (!nack_enabled_)
|
||||
EXPECT_EQ(0, parser.nack()->num_packets());
|
||||
if (parser.pli()->num_packets() > 0)
|
||||
|
@ -377,10 +377,10 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx,
|
|||
retransmitted_timestamp_(0) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
// Ignore padding-only packets over RTX.
|
||||
if (rtp_packet.PayloadType() != payload_type_) {
|
||||
|
|
|
@ -48,7 +48,7 @@ void RtpRtcpEndToEndTest::RespectsRtcpMode(RtcpMode rtcp_mode) {
|
|||
sent_rtcp_(0) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
if (++sent_rtp_ % 3 == 0)
|
||||
return DROP_PACKET;
|
||||
|
@ -56,11 +56,11 @@ void RtpRtcpEndToEndTest::RespectsRtcpMode(RtcpMode rtcp_mode) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
++sent_rtcp_;
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
|
||||
EXPECT_EQ(0, parser.sender_report()->num_packets());
|
||||
|
||||
|
@ -211,9 +211,9 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
|
|||
}
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
const uint32_t ssrc = rtp_packet.Ssrc();
|
||||
const int64_t sequence_number =
|
||||
seq_numbers_unwrapper_.Unwrap(rtp_packet.SequenceNumber());
|
||||
|
@ -261,9 +261,9 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
test::RtcpPacketParser rtcp_parser;
|
||||
rtcp_parser.Parse(packet, length);
|
||||
rtcp_parser.Parse(packet);
|
||||
if (rtcp_parser.sender_report()->num_packets() > 0) {
|
||||
uint32_t ssrc = rtcp_parser.sender_report()->sender_ssrc();
|
||||
uint32_t rtcp_timestamp = rtcp_parser.sender_report()->rtp_timestamp();
|
||||
|
@ -405,11 +405,11 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) {
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
const uint16_t sequence_number = rtp_packet.SequenceNumber();
|
||||
const uint32_t timestamp = rtp_packet.Timestamp();
|
||||
const uint32_t ssrc = rtp_packet.Ssrc();
|
||||
|
|
|
@ -41,9 +41,9 @@ TEST_F(SsrcEndToEndTest, ReceiverUsesLocalSsrc) {
|
|||
SyncRtcpObserver()
|
||||
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout) {}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
EXPECT_EQ(test::VideoTestConstants::kReceiverLocalVideoSsrc,
|
||||
parser.sender_ssrc());
|
||||
observation_complete_.Set();
|
||||
|
@ -163,9 +163,9 @@ void SsrcEndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_TRUE(valid_ssrcs_[rtp_packet.Ssrc()])
|
||||
<< "Received unknown SSRC: " << rtp_packet.Ssrc();
|
||||
|
@ -271,9 +271,9 @@ TEST_F(SsrcEndToEndTest, DISABLED_RedundantPayloadsTransmittedOnAllSsrcs) {
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
if (!registered_rtx_ssrc_[rtp_packet.Ssrc()])
|
||||
return SEND_PACKET;
|
||||
|
|
|
@ -59,11 +59,11 @@ TEST_F(StatsEndToEndTest, GetStats) {
|
|||
}) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
// Drop every 25th packet => 4% loss.
|
||||
static const int kPacketLossFrac = 25;
|
||||
RtpPacket header;
|
||||
if (header.Parse(packet, length) &&
|
||||
if (header.Parse(packet) &&
|
||||
expected_send_ssrcs_.find(header.Ssrc()) !=
|
||||
expected_send_ssrcs_.end() &&
|
||||
header.SequenceNumber() % kPacketLossFrac == 0) {
|
||||
|
@ -73,17 +73,17 @@ TEST_F(StatsEndToEndTest, GetStats) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
check_stats_event_.Set();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
check_stats_event_.Set();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
check_stats_event_.Set();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ TEST_F(StatsEndToEndTest, TestReceivedRtpPacketStats) {
|
|||
|
||||
void OnStreamsStopped() override { task_safety_flag_->SetNotAlive(); }
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
if (sent_rtp_ >= kNumRtpPacketsToSend) {
|
||||
// Need to check the stats on the correct thread.
|
||||
task_queue_->PostTask(SafeTask(task_safety_flag_, [this]() {
|
||||
|
@ -489,7 +489,7 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
|
|||
}
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
if (MinNumberOfFramesReceived())
|
||||
observation_complete_.Set();
|
||||
return SEND_PACKET;
|
||||
|
@ -603,12 +603,12 @@ TEST_F(StatsEndToEndTest, VerifyNackStats) {
|
|||
task_queue_(task_queue) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
{
|
||||
MutexLock lock(&mutex_);
|
||||
if (++sent_rtp_packets_ == kPacketNumberToDrop) {
|
||||
RtpPacket header;
|
||||
EXPECT_TRUE(header.Parse(packet, length));
|
||||
EXPECT_TRUE(header.Parse(packet));
|
||||
dropped_rtp_packet_ = header.SequenceNumber();
|
||||
return DROP_PACKET;
|
||||
}
|
||||
|
@ -618,10 +618,10 @@ TEST_F(StatsEndToEndTest, VerifyNackStats) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
test::RtcpPacketParser rtcp_parser;
|
||||
rtcp_parser.Parse(packet, length);
|
||||
rtcp_parser.Parse(packet);
|
||||
const std::vector<uint16_t>& nacks = rtcp_parser.nack()->packet_ids();
|
||||
if (!nacks.empty() && absl::c_linear_search(nacks, dropped_rtp_packet_)) {
|
||||
dropped_rtp_packet_requested_ = true;
|
||||
|
|
|
@ -70,8 +70,7 @@ TEST(TransportFeedbackMultiStreamTest, AssignsTransportSequenceNumbers) {
|
|||
}
|
||||
virtual ~RtpExtensionHeaderObserver() {}
|
||||
|
||||
bool SendRtp(const uint8_t* data,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> data,
|
||||
const PacketOptions& options) override {
|
||||
{
|
||||
MutexLock lock(&lock_);
|
||||
|
@ -81,7 +80,7 @@ TEST(TransportFeedbackMultiStreamTest, AssignsTransportSequenceNumbers) {
|
|||
|
||||
if (started_) {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(data, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(data));
|
||||
bool drop_packet = false;
|
||||
|
||||
uint16_t transport_sequence_number = 0;
|
||||
|
@ -131,7 +130,7 @@ TEST(TransportFeedbackMultiStreamTest, AssignsTransportSequenceNumbers) {
|
|||
}
|
||||
}
|
||||
|
||||
return test::DirectTransport::SendRtp(data, length, options);
|
||||
return test::DirectTransport::SendRtp(data, options);
|
||||
}
|
||||
|
||||
bool IsDone() {
|
||||
|
@ -262,20 +261,20 @@ class TransportFeedbackTester : public test::EndToEndTest {
|
|||
}
|
||||
|
||||
protected:
|
||||
Action OnSendRtcp(const uint8_t* data, size_t length) override {
|
||||
EXPECT_FALSE(HasTransportFeedback(data, length));
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
EXPECT_FALSE(HasTransportFeedback(data));
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* data, size_t length) override {
|
||||
if (HasTransportFeedback(data, length))
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
if (HasTransportFeedback(data))
|
||||
observation_complete_.Set();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
bool HasTransportFeedback(const uint8_t* data, size_t length) const {
|
||||
bool HasTransportFeedback(rtc::ArrayView<const uint8_t> data) const {
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(data, length));
|
||||
EXPECT_TRUE(parser.Parse(data));
|
||||
return parser.transport_feedback()->num_packets() > 0;
|
||||
}
|
||||
|
||||
|
@ -340,9 +339,9 @@ TEST_F(TransportFeedbackEndToEndTest,
|
|||
}
|
||||
|
||||
protected:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
const bool only_padding = rtp_packet.payload_size() == 0;
|
||||
MutexLock lock(&mutex_);
|
||||
// Padding is expected in congested state to probe for connectivity when
|
||||
|
@ -363,7 +362,7 @@ TEST_F(TransportFeedbackEndToEndTest,
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnReceiveRtcp(const uint8_t* data, size_t length) override {
|
||||
Action OnReceiveRtcp(rtc::ArrayView<const uint8_t> data) override {
|
||||
MutexLock lock(&mutex_);
|
||||
// To fill up the congestion window we drop feedback on packets after 20
|
||||
// packets have been sent. This means that any packets that has not yet
|
||||
|
@ -374,16 +373,15 @@ TEST_F(TransportFeedbackEndToEndTest,
|
|||
// padding packets and when 2 padding packets have been received, feedback
|
||||
// will be let trough again. This should cause the pacer to continue
|
||||
// sending meadia yet again.
|
||||
if (media_sent_ > 20 && HasTransportFeedback(data, length) &&
|
||||
padding_sent_ < 2) {
|
||||
if (media_sent_ > 20 && HasTransportFeedback(data) && padding_sent_ < 2) {
|
||||
return DROP_PACKET;
|
||||
}
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
bool HasTransportFeedback(const uint8_t* data, size_t length) const {
|
||||
bool HasTransportFeedback(rtc::ArrayView<const uint8_t> data) const {
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(data, length));
|
||||
EXPECT_TRUE(parser.Parse(data));
|
||||
return parser.transport_feedback()->num_packets() > 0;
|
||||
}
|
||||
void ModifySenderBitrateConfig(
|
||||
|
@ -435,9 +433,9 @@ TEST_F(TransportFeedbackEndToEndTest, TransportSeqNumOnAudioAndVideo) {
|
|||
kTransportSequenceNumberExtensionId));
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
uint16_t transport_sequence_number = 0;
|
||||
EXPECT_TRUE(rtp_packet.GetExtension<TransportSequenceNumber>(
|
||||
&transport_sequence_number));
|
||||
|
|
|
@ -175,11 +175,11 @@ class PictureIdObserver : public test::RtpRtcpObserver {
|
|||
}
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
ParsedPacket parsed;
|
||||
if (!ParsePayload(packet, length, &parsed))
|
||||
if (!ParsePayload(packet.data(), packet.size(), &parsed))
|
||||
return SEND_PACKET;
|
||||
|
||||
uint32_t ssrc = parsed.ssrc;
|
||||
|
|
|
@ -157,7 +157,7 @@ class ScalingObserver : public test::SendTest {
|
|||
test_params_.size());
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
// The tests are expected to send at the configured start bitrate. Do not
|
||||
// send any packets to avoid receiving REMB and possibly go down in target
|
||||
// bitrate. A low bitrate estimate could result in downgrading due to other
|
||||
|
|
|
@ -272,15 +272,14 @@ void VideoAnalyzer::PostEncodeOnFrame(size_t stream_id, uint32_t timestamp) {
|
|||
}
|
||||
}
|
||||
|
||||
bool VideoAnalyzer::SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool VideoAnalyzer::SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) {
|
||||
RtpPacket rtp_packet;
|
||||
rtp_packet.Parse(packet, length);
|
||||
rtp_packet.Parse(packet);
|
||||
|
||||
int64_t current_time = clock_->CurrentNtpInMilliseconds();
|
||||
|
||||
bool result = transport_->SendRtp(packet, length, options);
|
||||
bool result = transport_->SendRtp(packet, options);
|
||||
{
|
||||
MutexLock lock(&lock_);
|
||||
if (rtp_timestamp_delta_ == 0 && rtp_packet.Ssrc() == ssrc_to_analyze_) {
|
||||
|
@ -306,8 +305,8 @@ bool VideoAnalyzer::SendRtp(const uint8_t* packet,
|
|||
return result;
|
||||
}
|
||||
|
||||
bool VideoAnalyzer::SendRtcp(const uint8_t* packet, size_t length) {
|
||||
return transport_->SendRtcp(packet, length);
|
||||
bool VideoAnalyzer::SendRtcp(rtc::ArrayView<const uint8_t> packet) {
|
||||
return transport_->SendRtcp(packet);
|
||||
}
|
||||
|
||||
void VideoAnalyzer::OnFrame(const VideoFrame& video_frame) {
|
||||
|
|
|
@ -76,11 +76,10 @@ class VideoAnalyzer : public PacketReceiver,
|
|||
void PreEncodeOnFrame(const VideoFrame& video_frame);
|
||||
void PostEncodeOnFrame(size_t stream_id, uint32_t timestamp);
|
||||
|
||||
bool SendRtp(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool SendRtp(rtc::ArrayView<const uint8_t> packet,
|
||||
const PacketOptions& options) override;
|
||||
|
||||
bool SendRtcp(const uint8_t* packet, size_t length) override;
|
||||
bool SendRtcp(rtc::ArrayView<const uint8_t> packet) override;
|
||||
void OnFrame(const VideoFrame& video_frame) override;
|
||||
void Wait();
|
||||
|
||||
|
|
|
@ -190,9 +190,9 @@ TEST_F(VideoSendStreamTest, SupportsCName) {
|
|||
CNameObserver() : SendTest(test::VideoTestConstants::kDefaultTimeout) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
if (parser.sdes()->num_packets() > 0) {
|
||||
EXPECT_EQ(1u, parser.sdes()->chunks().size());
|
||||
EXPECT_EQ(kCName, parser.sdes()->chunks()[0].cname);
|
||||
|
@ -226,9 +226,9 @@ TEST_F(VideoSendStreamTest, SupportsAbsoluteSendTime) {
|
|||
extensions_.Register<AbsoluteSendTime>(kAbsSendTimeExtensionId);
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
uint32_t abs_send_time = 0;
|
||||
EXPECT_FALSE(rtp_packet.HasExtension<TransmissionOffset>());
|
||||
|
@ -282,9 +282,9 @@ TEST_F(VideoSendStreamTest, SupportsTransmissionTimeOffset) {
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
int32_t toffset = 0;
|
||||
EXPECT_TRUE(rtp_packet.GetExtension<TransmissionOffset>(&toffset));
|
||||
|
@ -330,9 +330,9 @@ TEST_F(VideoSendStreamTest, SupportsTransportWideSequenceNumbers) {
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_TRUE(rtp_packet.HasExtension<TransportSequenceNumber>());
|
||||
EXPECT_FALSE(rtp_packet.HasExtension<TransmissionOffset>());
|
||||
|
@ -369,9 +369,9 @@ TEST_F(VideoSendStreamTest, SupportsVideoRotation) {
|
|||
extensions_.Register<VideoOrientation>(kVideoRotationExtensionId);
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
// Only the last packet of the frame is required to have the extension.
|
||||
if (!rtp_packet.Marker())
|
||||
return SEND_PACKET;
|
||||
|
@ -415,9 +415,9 @@ TEST_F(VideoSendStreamTest, SupportsVideoContentType) {
|
|||
kVideoContentTypeExtensionId);
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
// Only the last packet of the key-frame must have extension.
|
||||
if (!rtp_packet.Marker() || first_frame_sent_)
|
||||
return SEND_PACKET;
|
||||
|
@ -461,9 +461,9 @@ TEST_F(VideoSendStreamTest, SupportsVideoTimingFrames) {
|
|||
extensions_.Register<VideoTimingExtension>(kVideoTimingExtensionId);
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
// Only the last packet of the frame must have extension.
|
||||
// Also don't check packets of the second frame if they happen to get
|
||||
// through before the test terminates.
|
||||
|
@ -545,9 +545,9 @@ class UlpfecObserver : public test::EndToEndTest {
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
int encapsulated_payload_type = -1;
|
||||
if (rtp_packet.PayloadType() == test::VideoTestConstants::kRedPayloadType) {
|
||||
|
@ -771,9 +771,9 @@ class FlexfecObserver : public test::EndToEndTest {
|
|||
size_t GetNumVideoStreams() const override { return num_video_streams_; }
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet(&extensions_);
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
if (rtp_packet.PayloadType() ==
|
||||
test::VideoTestConstants::kFlexfecPayloadType) {
|
||||
|
@ -944,9 +944,9 @@ void VideoSendStreamTest::TestNackRetransmission(
|
|||
retransmit_payload_type_(retransmit_payload_type) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
// NACK packets two times at some arbitrary points.
|
||||
const int kNackedPacketsAtOnceCount = 3;
|
||||
|
@ -1105,10 +1105,10 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
|
|||
}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t size) override {
|
||||
size_t length = size;
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
size_t length = packet.size();
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_LE(length, max_packet_size_);
|
||||
|
||||
|
@ -1325,12 +1325,12 @@ TEST_F(VideoSendStreamTest, NoPaddingWhenVideoIsMuted) {
|
|||
capturer_(nullptr) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
last_packet_time_ms_ = clock_->TimeInMilliseconds();
|
||||
|
||||
RtpPacket rtp_packet;
|
||||
rtp_packet.Parse(packet, length);
|
||||
rtp_packet.Parse(packet);
|
||||
const bool only_padding = rtp_packet.payload_size() == 0;
|
||||
|
||||
if (test_state_ == kBeforeStopCapture) {
|
||||
|
@ -1353,7 +1353,7 @@ TEST_F(VideoSendStreamTest, NoPaddingWhenVideoIsMuted) {
|
|||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
const int kNoPacketsThresholdMs = 2000;
|
||||
if (test_state_ == kWaitingForNoPackets &&
|
||||
|
@ -1420,13 +1420,13 @@ TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) {
|
|||
call_ = sender_call;
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
|
||||
RtpPacket rtp_packet;
|
||||
rtp_packet.Parse(packet, length);
|
||||
rtp_packet.Parse(packet);
|
||||
padding_length_ += rtp_packet.padding_size();
|
||||
total_length_ += length;
|
||||
total_length_ += packet.size();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
|
@ -1495,12 +1495,12 @@ TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) {
|
|||
task_safety_flag_(PendingTaskSafetyFlag::CreateDetached()) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
if (IsRtcpPacket(rtc::MakeArrayView(packet, length)))
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
if (IsRtcpPacket(packet))
|
||||
return DROP_PACKET;
|
||||
|
||||
RtpPacket rtp_packet;
|
||||
RTC_CHECK(rtp_packet.Parse(packet, length));
|
||||
RTC_CHECK(rtp_packet.Parse(packet));
|
||||
const uint32_t ssrc = rtp_packet.Ssrc();
|
||||
RTC_DCHECK(stream_);
|
||||
|
||||
|
@ -1619,7 +1619,7 @@ TEST_F(VideoSendStreamTest, ChangingNetworkRoute) {
|
|||
RtpExtension::kTransportSequenceNumberUri, kExtensionId));
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RTC_DCHECK_RUN_ON(&module_process_thread_);
|
||||
task_queue_->PostTask([this]() {
|
||||
RTC_DCHECK_RUN_ON(&task_queue_thread_);
|
||||
|
@ -1719,7 +1719,7 @@ TEST_F(VideoSendStreamTest, DISABLED_RelayToDirectRoute) {
|
|||
call_ = sender_call;
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RTC_DCHECK_RUN_ON(&module_process_thread_);
|
||||
task_queue_->PostTask([this]() {
|
||||
RTC_DCHECK_RUN_ON(&task_queue_thread_);
|
||||
|
@ -1803,8 +1803,8 @@ TEST_F(VideoSendStreamTest, ChangingTransportOverhead) {
|
|||
call_ = sender_call;
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
EXPECT_LE(length, kMaxRtpPacketSize);
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
EXPECT_LE(packet.size(), kMaxRtpPacketSize);
|
||||
MutexLock lock(&lock_);
|
||||
if (++packets_sent_ < 100)
|
||||
return SEND_PACKET;
|
||||
|
@ -1911,7 +1911,7 @@ class MaxPaddingSetTest : public test::SendTest {
|
|||
}
|
||||
|
||||
// Called on the pacer thread.
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RTC_DCHECK_RUN_ON(&module_process_thread_);
|
||||
|
||||
// Check the stats on the correct thread and signal the 'complete' flag
|
||||
|
@ -2570,19 +2570,19 @@ TEST_F(VideoSendStreamTest, RtcpSenderReportContainsMediaBytesSent) {
|
|||
media_bytes_sent_(0) {}
|
||||
|
||||
private:
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
++rtp_packets_sent_;
|
||||
media_bytes_sent_ += rtp_packet.payload_size();
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtcp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
test::RtcpPacketParser parser;
|
||||
EXPECT_TRUE(parser.Parse(packet, length));
|
||||
EXPECT_TRUE(parser.Parse(packet));
|
||||
|
||||
if (parser.sender_report()->num_packets() > 0) {
|
||||
// Only compare sent media bytes if SenderPacketCount matches the
|
||||
|
@ -3034,9 +3034,9 @@ class Vp9HeaderObserver : public test::SendTest {
|
|||
}
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
EXPECT_EQ(kVp9PayloadType, rtp_packet.PayloadType());
|
||||
rtc::ArrayView<const uint8_t> rtp_payload = rtp_packet.payload();
|
||||
|
@ -3739,7 +3739,7 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) {
|
|||
EXPECT_FALSE(send_config->rtp.extensions.empty());
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
MutexLock lock(&mutex_);
|
||||
first_packet_sent_ = true;
|
||||
return SEND_PACKET;
|
||||
|
@ -3922,7 +3922,7 @@ class ContentSwitchTest : public test::SendTest {
|
|||
done_ = true;
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
task_queue_->PostTask([this]() {
|
||||
MutexLock lock(&mutex_);
|
||||
if (done_)
|
||||
|
@ -4118,11 +4118,10 @@ void VideoSendStreamTest::TestTemporalLayers(
|
|||
int temporal_idx;
|
||||
};
|
||||
|
||||
bool ParsePayload(const uint8_t* packet,
|
||||
size_t length,
|
||||
bool ParsePayload(rtc::ArrayView<const uint8_t> packet,
|
||||
ParsedPacket& parsed) const {
|
||||
RtpPacket rtp_packet;
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet, length));
|
||||
EXPECT_TRUE(rtp_packet.Parse(packet));
|
||||
|
||||
if (rtp_packet.payload_size() == 0) {
|
||||
return false; // Padding packet.
|
||||
|
@ -4146,9 +4145,9 @@ void VideoSendStreamTest::TestTemporalLayers(
|
|||
return true;
|
||||
}
|
||||
|
||||
Action OnSendRtp(const uint8_t* packet, size_t length) override {
|
||||
Action OnSendRtp(rtc::ArrayView<const uint8_t> packet) override {
|
||||
ParsedPacket parsed;
|
||||
if (!ParsePayload(packet, length, parsed))
|
||||
if (!ParsePayload(packet, parsed))
|
||||
return SEND_PACKET;
|
||||
|
||||
uint32_t ssrc = parsed.ssrc;
|
||||
|
|
Loading…
Reference in a new issue