// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cast/streaming/impl/rtp_packetizer.h" #include <chrono> #include <memory> #include <optional> #include "cast/streaming/impl/frame_crypto.h" #include "cast/streaming/impl/rtp_defines.h" #include "cast/streaming/impl/rtp_packet_parser.h" #include "cast/streaming/ssrc.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "util/chrono_helpers.h" #include "util/crypto/random_bytes.h" ElementsAreArray; namespace openscreen::cast { namespace { constexpr RtpPayloadType kPayloadType = …; // Returns true if |needle| is fully within |haystack|. bool IsSubspan(ByteView needle, ByteView haystack) { … } class RtpPacketizerTest : public testing::Test { … }; // Tests that all packets are generated for one key frame, followed by 9 "delta" // frames. The key frame is larger than the other frames, as is typical in a // real-world usage scenario. TEST_F(RtpPacketizerTest, GeneratesPacketsForSequenceOfFrames) { … } // Tests that all packets are generated for a key frame that includes a playout // delay change. Only the first packet should mention the playout delay change. TEST_F(RtpPacketizerTest, GeneratesPacketsForFrameWithLatencyChange) { … } // Tests that a single, valid RTP packet is generated for a frame with no data // payload. Having no payload is valid with some codecs (e.g., complete audio // silence can be represented by an empty payload). TEST_F(RtpPacketizerTest, GeneratesOnePacketForFrameWithNoPayload) { … } // Tests that re-generating the same packet for re-transmission works, including // a different sequence counter value in the packet each time. TEST_F(RtpPacketizerTest, GeneratesPacketForRetransmission) { … } } // namespace } // namespace openscreen::cast