Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "pc/composite_rtp_transport.h" |
| 12 | |
| 13 | #include <memory> |
| 14 | |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 15 | #include "modules/rtp_rtcp/source/rtp_packet_received.h" |
| 16 | #include "p2p/base/fake_packet_transport.h" |
| 17 | #include "pc/rtp_transport.h" |
| 18 | #include "test/gtest.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | namespace { |
| 22 | |
| 23 | constexpr char kTransportName[] = "test-transport"; |
| 24 | constexpr char kRtcpTransportName[] = "test-transport-rtcp"; |
| 25 | constexpr uint8_t kRtpPayloadType = 100; |
| 26 | |
| 27 | constexpr uint8_t kRtcpPacket[] = {0x80, 73, 0, 0}; |
| 28 | constexpr uint8_t kRtpPacket[] = {0x80, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 29 | |
| 30 | class CompositeRtpTransportTest : public ::testing::Test, |
| 31 | public sigslot::has_slots<>, |
| 32 | public RtpPacketSinkInterface { |
| 33 | public: |
| 34 | CompositeRtpTransportTest() |
| 35 | : packet_transport_1_( |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 36 | std::make_unique<rtc::FakePacketTransport>(kTransportName)), |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 37 | packet_transport_2_( |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 38 | std::make_unique<rtc::FakePacketTransport>(kTransportName)), |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 39 | rtcp_transport_1_( |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 40 | std::make_unique<rtc::FakePacketTransport>(kRtcpTransportName)), |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 41 | rtcp_transport_2_( |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 42 | std::make_unique<rtc::FakePacketTransport>(kRtcpTransportName)) {} |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 43 | |
| 44 | void SetupRtpTransports(bool rtcp_mux) { |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 45 | transport_1_ = std::make_unique<RtpTransport>(rtcp_mux); |
| 46 | transport_2_ = std::make_unique<RtpTransport>(rtcp_mux); |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 47 | |
| 48 | transport_1_->SetRtpPacketTransport(packet_transport_1_.get()); |
| 49 | transport_2_->SetRtpPacketTransport(packet_transport_2_.get()); |
| 50 | if (!rtcp_mux) { |
| 51 | transport_1_->SetRtcpPacketTransport(rtcp_transport_1_.get()); |
| 52 | transport_2_->SetRtcpPacketTransport(rtcp_transport_2_.get()); |
| 53 | } |
| 54 | |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 55 | composite_ = std::make_unique<CompositeRtpTransport>( |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 56 | std::vector<RtpTransportInternal*>{transport_1_.get(), |
| 57 | transport_2_.get()}); |
| 58 | |
| 59 | composite_->SignalReadyToSend.connect( |
| 60 | this, &CompositeRtpTransportTest::OnReadyToSend); |
| 61 | composite_->SignalWritableState.connect( |
| 62 | this, &CompositeRtpTransportTest::OnWritableState); |
| 63 | composite_->SignalSentPacket.connect( |
| 64 | this, &CompositeRtpTransportTest::OnSentPacket); |
| 65 | composite_->SignalNetworkRouteChanged.connect( |
| 66 | this, &CompositeRtpTransportTest::OnNetworkRouteChanged); |
| 67 | composite_->SignalRtcpPacketReceived.connect( |
| 68 | this, &CompositeRtpTransportTest::OnRtcpPacketReceived); |
| 69 | |
| 70 | RtpDemuxerCriteria criteria; |
| 71 | criteria.payload_types.insert(kRtpPayloadType); |
| 72 | composite_->RegisterRtpDemuxerSink(criteria, this); |
| 73 | } |
| 74 | |
| 75 | void TearDown() override { composite_->UnregisterRtpDemuxerSink(this); } |
| 76 | |
| 77 | void OnReadyToSend(bool ready) { ++ready_to_send_count_; } |
| 78 | void OnWritableState(bool writable) { ++writable_state_count_; } |
| 79 | void OnSentPacket(const rtc::SentPacket& packet) { ++sent_packet_count_; } |
| 80 | void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> route) { |
| 81 | ++network_route_count_; |
| 82 | last_network_route_ = route; |
| 83 | } |
| 84 | void OnRtcpPacketReceived(rtc::CopyOnWriteBuffer* buffer, |
| 85 | int64_t packet_time_us) { |
| 86 | ++rtcp_packet_count_; |
| 87 | last_packet_ = *buffer; |
| 88 | } |
| 89 | void OnRtpPacket(const RtpPacketReceived& packet) { |
| 90 | ++rtp_packet_count_; |
| 91 | last_packet_ = packet.Buffer(); |
| 92 | } |
| 93 | |
| 94 | protected: |
| 95 | std::unique_ptr<rtc::FakePacketTransport> packet_transport_1_; |
| 96 | std::unique_ptr<rtc::FakePacketTransport> packet_transport_2_; |
| 97 | std::unique_ptr<rtc::FakePacketTransport> rtcp_transport_1_; |
| 98 | std::unique_ptr<rtc::FakePacketTransport> rtcp_transport_2_; |
| 99 | std::unique_ptr<RtpTransport> transport_1_; |
| 100 | std::unique_ptr<RtpTransport> transport_2_; |
| 101 | std::unique_ptr<CompositeRtpTransport> composite_; |
| 102 | |
| 103 | int ready_to_send_count_ = 0; |
| 104 | int writable_state_count_ = 0; |
| 105 | int sent_packet_count_ = 0; |
| 106 | int network_route_count_ = 0; |
| 107 | int rtcp_packet_count_ = 0; |
| 108 | int rtp_packet_count_ = 0; |
| 109 | |
| 110 | absl::optional<rtc::NetworkRoute> last_network_route_; |
| 111 | rtc::CopyOnWriteBuffer last_packet_; |
| 112 | }; |
| 113 | |
| 114 | TEST_F(CompositeRtpTransportTest, EnableRtcpMux) { |
| 115 | SetupRtpTransports(/*rtcp_mux=*/false); |
| 116 | EXPECT_FALSE(composite_->rtcp_mux_enabled()); |
| 117 | EXPECT_FALSE(transport_1_->rtcp_mux_enabled()); |
| 118 | EXPECT_FALSE(transport_2_->rtcp_mux_enabled()); |
| 119 | |
| 120 | composite_->SetRtcpMuxEnabled(true); |
| 121 | EXPECT_TRUE(composite_->rtcp_mux_enabled()); |
| 122 | EXPECT_TRUE(transport_1_->rtcp_mux_enabled()); |
| 123 | EXPECT_TRUE(transport_2_->rtcp_mux_enabled()); |
| 124 | } |
| 125 | |
| 126 | TEST_F(CompositeRtpTransportTest, DisableRtcpMux) { |
| 127 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 128 | EXPECT_TRUE(composite_->rtcp_mux_enabled()); |
| 129 | EXPECT_TRUE(transport_1_->rtcp_mux_enabled()); |
| 130 | EXPECT_TRUE(transport_2_->rtcp_mux_enabled()); |
| 131 | |
| 132 | // If the component transports didn't have an RTCP transport before, they need |
| 133 | // to be set independently before disabling RTCP mux. There's no other sane |
| 134 | // way to do this, as the interface only allows sending a single RTCP |
| 135 | // transport, and we need one for each component. |
| 136 | transport_1_->SetRtcpPacketTransport(rtcp_transport_1_.get()); |
| 137 | transport_2_->SetRtcpPacketTransport(rtcp_transport_2_.get()); |
| 138 | |
| 139 | composite_->SetRtcpMuxEnabled(false); |
| 140 | EXPECT_FALSE(composite_->rtcp_mux_enabled()); |
| 141 | EXPECT_FALSE(transport_1_->rtcp_mux_enabled()); |
| 142 | EXPECT_FALSE(transport_2_->rtcp_mux_enabled()); |
| 143 | } |
| 144 | |
| 145 | TEST_F(CompositeRtpTransportTest, SetRtpOption) { |
| 146 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 147 | EXPECT_EQ(0, composite_->SetRtpOption(rtc::Socket::OPT_DSCP, 2)); |
| 148 | |
| 149 | int value = 0; |
| 150 | EXPECT_TRUE(packet_transport_1_->GetOption(rtc::Socket::OPT_DSCP, &value)); |
| 151 | EXPECT_EQ(value, 2); |
| 152 | |
| 153 | EXPECT_TRUE(packet_transport_2_->GetOption(rtc::Socket::OPT_DSCP, &value)); |
| 154 | EXPECT_EQ(value, 2); |
| 155 | } |
| 156 | |
| 157 | TEST_F(CompositeRtpTransportTest, SetRtcpOption) { |
| 158 | SetupRtpTransports(/*rtcp_mux=*/false); |
| 159 | EXPECT_EQ(0, composite_->SetRtcpOption(rtc::Socket::OPT_DSCP, 2)); |
| 160 | |
| 161 | int value = 0; |
| 162 | EXPECT_TRUE(rtcp_transport_1_->GetOption(rtc::Socket::OPT_DSCP, &value)); |
| 163 | EXPECT_EQ(value, 2); |
| 164 | |
| 165 | EXPECT_TRUE(rtcp_transport_2_->GetOption(rtc::Socket::OPT_DSCP, &value)); |
| 166 | EXPECT_EQ(value, 2); |
| 167 | } |
| 168 | |
| 169 | TEST_F(CompositeRtpTransportTest, NeverWritableWithoutSendTransport) { |
| 170 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 171 | |
| 172 | packet_transport_1_->SetWritable(true); |
| 173 | packet_transport_2_->SetWritable(true); |
| 174 | |
| 175 | EXPECT_FALSE(composite_->IsWritable(false)); |
| 176 | EXPECT_FALSE(composite_->IsWritable(true)); |
| 177 | EXPECT_FALSE(composite_->IsReadyToSend()); |
| 178 | EXPECT_EQ(0, ready_to_send_count_); |
| 179 | EXPECT_EQ(0, writable_state_count_); |
| 180 | } |
| 181 | |
| 182 | TEST_F(CompositeRtpTransportTest, WritableWhenSendTransportBecomesWritable) { |
| 183 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 184 | |
| 185 | composite_->SetSendTransport(transport_1_.get()); |
| 186 | |
| 187 | EXPECT_FALSE(composite_->IsWritable(false)); |
| 188 | EXPECT_FALSE(composite_->IsWritable(true)); |
| 189 | EXPECT_FALSE(composite_->IsReadyToSend()); |
| 190 | EXPECT_EQ(0, ready_to_send_count_); |
| 191 | EXPECT_EQ(1, writable_state_count_); |
| 192 | |
| 193 | packet_transport_2_->SetWritable(true); |
| 194 | |
| 195 | EXPECT_FALSE(composite_->IsWritable(false)); |
| 196 | EXPECT_FALSE(composite_->IsWritable(true)); |
| 197 | EXPECT_FALSE(composite_->IsReadyToSend()); |
| 198 | EXPECT_EQ(0, ready_to_send_count_); |
| 199 | EXPECT_EQ(1, writable_state_count_); |
| 200 | |
| 201 | packet_transport_1_->SetWritable(true); |
| 202 | |
| 203 | EXPECT_TRUE(composite_->IsWritable(false)); |
| 204 | EXPECT_TRUE(composite_->IsWritable(true)); |
| 205 | EXPECT_TRUE(composite_->IsReadyToSend()); |
| 206 | EXPECT_EQ(1, ready_to_send_count_); |
| 207 | EXPECT_EQ(2, writable_state_count_); |
| 208 | } |
| 209 | |
| 210 | TEST_F(CompositeRtpTransportTest, SendTransportAlreadyWritable) { |
| 211 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 212 | packet_transport_1_->SetWritable(true); |
| 213 | |
| 214 | composite_->SetSendTransport(transport_1_.get()); |
| 215 | |
| 216 | EXPECT_TRUE(composite_->IsWritable(false)); |
| 217 | EXPECT_TRUE(composite_->IsWritable(true)); |
| 218 | EXPECT_TRUE(composite_->IsReadyToSend()); |
| 219 | EXPECT_EQ(1, ready_to_send_count_); |
| 220 | EXPECT_EQ(1, writable_state_count_); |
| 221 | } |
| 222 | |
| 223 | TEST_F(CompositeRtpTransportTest, IsSrtpActive) { |
| 224 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 225 | EXPECT_FALSE(composite_->IsSrtpActive()); |
| 226 | } |
| 227 | |
| 228 | TEST_F(CompositeRtpTransportTest, NetworkRouteChange) { |
| 229 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 230 | |
| 231 | rtc::NetworkRoute route; |
Jonas Oreland | 71fda36 | 2020-03-20 16:11:56 +0100 | [diff] [blame] | 232 | route.local = rtc::RouteEndpoint::CreateWithNetworkId(7); |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 233 | packet_transport_1_->SetNetworkRoute(route); |
| 234 | |
| 235 | EXPECT_EQ(1, network_route_count_); |
Jonas Oreland | 71fda36 | 2020-03-20 16:11:56 +0100 | [diff] [blame] | 236 | EXPECT_EQ(7, last_network_route_->local.network_id()); |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 237 | |
Jonas Oreland | 71fda36 | 2020-03-20 16:11:56 +0100 | [diff] [blame] | 238 | route.local = rtc::RouteEndpoint::CreateWithNetworkId(8); |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 239 | packet_transport_2_->SetNetworkRoute(route); |
| 240 | |
| 241 | EXPECT_EQ(2, network_route_count_); |
Jonas Oreland | 71fda36 | 2020-03-20 16:11:56 +0100 | [diff] [blame] | 242 | EXPECT_EQ(8, last_network_route_->local.network_id()); |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Bjorn A Mellem | c85ebbe | 2019-06-07 10:28:06 -0700 | [diff] [blame] | 245 | TEST_F(CompositeRtpTransportTest, RemoveTransport) { |
| 246 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 247 | |
| 248 | composite_->RemoveTransport(transport_1_.get()); |
| 249 | |
| 250 | // Check that signals are disconnected. |
| 251 | rtc::NetworkRoute route; |
Jonas Oreland | 71fda36 | 2020-03-20 16:11:56 +0100 | [diff] [blame] | 252 | route.local = rtc::RouteEndpoint::CreateWithNetworkId(7); |
Bjorn A Mellem | c85ebbe | 2019-06-07 10:28:06 -0700 | [diff] [blame] | 253 | packet_transport_1_->SetNetworkRoute(route); |
| 254 | |
| 255 | EXPECT_EQ(0, network_route_count_); |
| 256 | } |
| 257 | |
Bjorn A Mellem | 44bd71c | 2019-05-28 15:25:38 -0700 | [diff] [blame] | 258 | TEST_F(CompositeRtpTransportTest, SendRtcpBeforeSendTransportSet) { |
| 259 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 260 | |
| 261 | rtc::FakePacketTransport remote("remote"); |
| 262 | remote.SetDestination(packet_transport_1_.get(), false); |
| 263 | |
| 264 | rtc::CopyOnWriteBuffer packet(kRtcpPacket); |
| 265 | EXPECT_FALSE(composite_->SendRtcpPacket(&packet, rtc::PacketOptions(), 0)); |
| 266 | EXPECT_EQ(0, sent_packet_count_); |
| 267 | } |
| 268 | |
| 269 | TEST_F(CompositeRtpTransportTest, SendRtcpOn1) { |
| 270 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 271 | |
| 272 | rtc::FakePacketTransport remote("remote"); |
| 273 | remote.SetDestination(packet_transport_1_.get(), false); |
| 274 | composite_->SetSendTransport(transport_1_.get()); |
| 275 | |
| 276 | rtc::CopyOnWriteBuffer packet(kRtcpPacket); |
| 277 | EXPECT_TRUE(composite_->SendRtcpPacket(&packet, rtc::PacketOptions(), 0)); |
| 278 | EXPECT_EQ(1, sent_packet_count_); |
| 279 | EXPECT_EQ(packet, *packet_transport_1_->last_sent_packet()); |
| 280 | } |
| 281 | |
| 282 | TEST_F(CompositeRtpTransportTest, SendRtcpOn2) { |
| 283 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 284 | |
| 285 | rtc::FakePacketTransport remote("remote"); |
| 286 | remote.SetDestination(packet_transport_2_.get(), false); |
| 287 | composite_->SetSendTransport(transport_2_.get()); |
| 288 | |
| 289 | rtc::CopyOnWriteBuffer packet(kRtcpPacket); |
| 290 | EXPECT_TRUE(composite_->SendRtcpPacket(&packet, rtc::PacketOptions(), 0)); |
| 291 | EXPECT_EQ(1, sent_packet_count_); |
| 292 | EXPECT_EQ(packet, *packet_transport_2_->last_sent_packet()); |
| 293 | } |
| 294 | |
| 295 | TEST_F(CompositeRtpTransportTest, SendRtpBeforeSendTransportSet) { |
| 296 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 297 | |
| 298 | rtc::FakePacketTransport remote("remote"); |
| 299 | remote.SetDestination(packet_transport_1_.get(), false); |
| 300 | |
| 301 | rtc::CopyOnWriteBuffer packet(kRtpPacket); |
| 302 | EXPECT_FALSE(composite_->SendRtpPacket(&packet, rtc::PacketOptions(), 0)); |
| 303 | EXPECT_EQ(0, sent_packet_count_); |
| 304 | } |
| 305 | |
| 306 | TEST_F(CompositeRtpTransportTest, SendRtpOn1) { |
| 307 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 308 | |
| 309 | rtc::FakePacketTransport remote("remote"); |
| 310 | remote.SetDestination(packet_transport_1_.get(), false); |
| 311 | composite_->SetSendTransport(transport_1_.get()); |
| 312 | |
| 313 | rtc::CopyOnWriteBuffer packet(kRtpPacket); |
| 314 | EXPECT_TRUE(composite_->SendRtpPacket(&packet, rtc::PacketOptions(), 0)); |
| 315 | EXPECT_EQ(1, sent_packet_count_); |
| 316 | EXPECT_EQ(packet, *packet_transport_1_->last_sent_packet()); |
| 317 | } |
| 318 | |
| 319 | TEST_F(CompositeRtpTransportTest, SendRtpOn2) { |
| 320 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 321 | |
| 322 | rtc::FakePacketTransport remote("remote"); |
| 323 | remote.SetDestination(packet_transport_2_.get(), false); |
| 324 | composite_->SetSendTransport(transport_2_.get()); |
| 325 | |
| 326 | rtc::CopyOnWriteBuffer packet(kRtpPacket); |
| 327 | EXPECT_TRUE(composite_->SendRtpPacket(&packet, rtc::PacketOptions(), 0)); |
| 328 | EXPECT_EQ(1, sent_packet_count_); |
| 329 | EXPECT_EQ(packet, *packet_transport_2_->last_sent_packet()); |
| 330 | } |
| 331 | |
| 332 | TEST_F(CompositeRtpTransportTest, ReceiveRtcpFrom1) { |
| 333 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 334 | |
| 335 | rtc::FakePacketTransport remote("remote"); |
| 336 | remote.SetDestination(packet_transport_1_.get(), false); |
| 337 | |
| 338 | rtc::CopyOnWriteBuffer packet(kRtcpPacket); |
| 339 | remote.SendPacket(packet.cdata<char>(), packet.size(), rtc::PacketOptions(), |
| 340 | 0); |
| 341 | |
| 342 | EXPECT_EQ(1, rtcp_packet_count_); |
| 343 | EXPECT_EQ(packet, last_packet_); |
| 344 | } |
| 345 | |
| 346 | TEST_F(CompositeRtpTransportTest, ReceiveRtcpFrom2) { |
| 347 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 348 | |
| 349 | rtc::FakePacketTransport remote("remote"); |
| 350 | remote.SetDestination(packet_transport_2_.get(), false); |
| 351 | |
| 352 | rtc::CopyOnWriteBuffer packet(kRtcpPacket); |
| 353 | remote.SendPacket(packet.cdata<char>(), packet.size(), rtc::PacketOptions(), |
| 354 | 0); |
| 355 | |
| 356 | EXPECT_EQ(1, rtcp_packet_count_); |
| 357 | EXPECT_EQ(packet, last_packet_); |
| 358 | } |
| 359 | |
| 360 | TEST_F(CompositeRtpTransportTest, ReceiveRtpFrom1) { |
| 361 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 362 | |
| 363 | rtc::FakePacketTransport remote("remote"); |
| 364 | remote.SetDestination(packet_transport_1_.get(), false); |
| 365 | |
| 366 | rtc::CopyOnWriteBuffer packet(kRtpPacket); |
| 367 | remote.SendPacket(packet.cdata<char>(), packet.size(), rtc::PacketOptions(), |
| 368 | 0); |
| 369 | |
| 370 | EXPECT_EQ(1, rtp_packet_count_); |
| 371 | EXPECT_EQ(packet, last_packet_); |
| 372 | } |
| 373 | |
| 374 | TEST_F(CompositeRtpTransportTest, ReceiveRtpFrom2) { |
| 375 | SetupRtpTransports(/*rtcp_mux=*/true); |
| 376 | |
| 377 | rtc::FakePacketTransport remote("remote"); |
| 378 | remote.SetDestination(packet_transport_2_.get(), false); |
| 379 | |
| 380 | rtc::CopyOnWriteBuffer packet(kRtpPacket); |
| 381 | remote.SendPacket(packet.cdata<char>(), packet.size(), rtc::PacketOptions(), |
| 382 | 0); |
| 383 | |
| 384 | EXPECT_EQ(1, rtp_packet_count_); |
| 385 | EXPECT_EQ(packet, last_packet_); |
| 386 | } |
| 387 | |
| 388 | } // namespace |
| 389 | } // namespace webrtc |