// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CAST_STREAMING_SENDER_PACKET_ROUTER_H_ #define CAST_STREAMING_SENDER_PACKET_ROUTER_H_ #include <stdint.h> #include <chrono> #include <memory> #include <vector> #include "cast/streaming/impl/bandwidth_estimator.h" #include "cast/streaming/public/constants.h" #include "cast/streaming/public/environment.h" #include "cast/streaming/ssrc.h" #include "platform/api/time.h" #include "platform/base/span.h" #include "util/alarm.h" namespace openscreen::cast { // Manages network packet transmission for one or more Senders, directing each // inbound packet to a specific Sender instance, pacing the transmission of // outbound packets, and employing network bandwidth/availability monitoring and // congestion control. // // Instead of just sending packets whenever they want, Senders must request // transmission from the SenderPacketRouter. The router then calls-back to each // Sender, in the near future, when it has allocated an available time slice for // transmission. The Sender is allowed to decide, at that exact moment, which // packet most needs to be sent. // // Pacing strategy: Packets are sent in bursts. This allows the platform // (operating system) to collect many small packets into a short-term buffer, // which allows for optimizations at the link layer. For example, multiple // packets can be sent together as one larger transmission unit, and this can be // critical for good performance over shared-medium networks (such as 802.11 // WiFi). https://en.wikipedia.org/wiki/Frame-bursting class SenderPacketRouter : public BandwidthEstimator, public Environment::PacketConsumer { … }; } // namespace openscreen::cast #endif // CAST_STREAMING_SENDER_PACKET_ROUTER_H_