#include "cast/streaming/sender_packet_router.h"
#include <chrono>
#include "cast/streaming/public/constants.h"
#include "cast/streaming/testing/mock_environment.h"
#include "cast/streaming/testing/simple_socket_subscriber.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "platform/base/ip_address.h"
#include "platform/test/fake_clock.h"
#include "platform/test/fake_task_runner.h"
#include "util/big_endian.h"
#include "util/chrono_helpers.h"
#include "util/osp_logging.h"
_;
ElementsAreArray;
Invoke;
Mock;
Return;
namespace openscreen::cast {
namespace {
const IPEndpoint kRemoteEndpoint{ … };
const IPEndpoint kUnexpectedEndpoint{ … };
constexpr int kMaxPacketsPerBurst = …;
constexpr auto kBurstInterval = …;
constexpr Ssrc kAudioReceiverSsrc = …;
constexpr Ssrc kVideoReceiverSsrc = …;
const uint8_t kGarbagePacket[] = …;
const uint8_t kValidAudioRtcpPacket[] = …;
const uint8_t kValidAudioRtpPacket[] = …;
std::vector<uint8_t> MakeRtcpPacketWithAlternateReceiverSsrc(
ByteView original,
Ssrc alternate_ssrc) { … }
ByteBuffer MakeFakePacketWithFlag(char flag,
Clock::time_point send_time,
ByteBuffer buffer) { … }
ByteBuffer MakeFakePacket(Clock::time_point send_time, ByteBuffer buffer) { … }
char ParseFlag(ByteView fake_packet) { … }
Clock::time_point ParseTimestamp(ByteView fake_packet) { … }
ByteBuffer ToEmptyPacketBuffer(Clock::time_point send_time, ByteBuffer buffer) { … }
class MockSender : public SenderPacketRouter::Sender { … };
class SenderPacketRouterTest : public testing::Test { … };
TEST_F(SenderPacketRouterTest, IsConfiguredFromBurstParameters) { … }
TEST_F(SenderPacketRouterTest, IgnoresPacketsFromUnexpectedSources) { … }
TEST_F(SenderPacketRouterTest, IgnoresInboundPacketsContainingGarbage) { … }
TEST_F(SenderPacketRouterTest, IgnoresInboundRtpPackets) { … }
TEST_F(SenderPacketRouterTest, IgnoresInboundRtcpPacketsFromUnknownReceivers) { … }
TEST_F(SenderPacketRouterTest, RoutesRTCPPacketsFromReceivers) { … }
TEST_F(SenderPacketRouterTest, SchedulesPeriodicTransmissionOfRTCPPackets) { … }
TEST_F(SenderPacketRouterTest, SchedulesAndTransmitsRTPBursts) { … }
TEST_F(SenderPacketRouterTest, SchedulesAndTransmitsAccountingForPriority) { … }
}
}