/* * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef NET_DCSCTP_TX_STREAM_SCHEDULER_H_ #define NET_DCSCTP_TX_STREAM_SCHEDULER_H_ #include <algorithm> #include <cstdint> #include <deque> #include <map> #include <memory> #include <queue> #include <set> #include <string> #include <utility> #include "absl/algorithm/container.h" #include "absl/memory/memory.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/array_view.h" #include "net/dcsctp/packet/chunk/idata_chunk.h" #include "net/dcsctp/packet/sctp_packet.h" #include "net/dcsctp/public/dcsctp_message.h" #include "net/dcsctp/public/dcsctp_socket.h" #include "net/dcsctp/public/types.h" #include "net/dcsctp/tx/send_queue.h" #include "rtc_base/containers/flat_set.h" #include "rtc_base/strong_alias.h" namespace dcsctp { // A parameterized stream scheduler. Currently, it implements the round robin // scheduling algorithm using virtual finish time. It is to be used as a part of // a send queue and will track all active streams (streams that have any data // that can be sent). // // The stream scheduler works with the concept of associating active streams // with a "virtual finish time", which is the time when a stream is allowed to // produce data. Streams are ordered by their virtual finish time, and the // "current virtual time" will advance to the next following virtual finish time // whenever a chunk is to be produced. // // When message interleaving is enabled, the WFQ - Weighted Fair Queueing - // scheduling algorithm will be used. And when it's not, round-robin scheduling // will be used instead. // // In the round robin scheduling algorithm, a stream's virtual finish time will // just increment by one (1) after having produced a chunk, which results in a // round-robin scheduling. // // In WFQ scheduling algorithm, a stream's virtual finish time will be defined // as the number of bytes in the next fragment to be sent, multiplied by the // inverse of the stream's priority, meaning that a high priority - or a smaller // fragment - results in a closer virtual finish time, compared to a stream with // either a lower priority or a larger fragment to be sent. class StreamScheduler { … }; } // namespace dcsctp #endif // NET_DCSCTP_TX_STREAM_SCHEDULER_H_