chromium/third_party/webrtc/modules/rtp_rtcp/source/rtp_sender.cc

/*
 *  Copyright (c) 2012 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.
 */

#include "modules/rtp_rtcp/source/rtp_sender.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/rtp_headers.h"
#include "api/rtp_packet_sender.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/corruption_detection_extension.h"
#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h"
#include "modules/rtp_rtcp/source/rtp_header_extension_size.h"
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet_history.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/rate_limiter.h"
#include "rtc_base/synchronization/mutex.h"

namespace webrtc {

namespace {
constexpr size_t kMinAudioPaddingLength =;
constexpr size_t kRtpHeaderLength =;

// Min size needed to get payload padding from packet history.
constexpr int kMinPayloadPaddingBytes =;

// Determines how much larger a payload padding packet may be, compared to the
// requested padding size.
constexpr double kMaxPaddingSizeFactor =;

template <typename Extension>
constexpr RtpExtensionSize CreateExtensionSize() {}

template <typename Extension>
constexpr RtpExtensionSize CreateMaxExtensionSize() {}

// Size info for header extensions that might be used in padding or FEC packets.
constexpr RtpExtensionSize kFecOrPaddingExtensionSizes[] =;

// Size info for header extensions that might be used in video packets.
constexpr RtpExtensionSize kVideoExtensionSizes[] =;

// Size info for header extensions that might be used in audio packets.
constexpr RtpExtensionSize kAudioExtensionSizes[] =;

// Non-volatile extensions can be expected on all packets, if registered.
// Volatile ones, such as VideoContentTypeExtension which is only set on
// key-frames, are removed to simplify overhead calculations at the expense of
// some accuracy.
bool IsNonVolatile(RTPExtensionType type) {}

bool HasBweExtension(const RtpHeaderExtensionMap& extensions_map) {}

}  // namespace

RTPSender::RTPSender(const RtpRtcpInterface::Configuration& config,
                     RtpPacketHistory* packet_history,
                     RtpPacketSender* packet_sender)
    :{}

RTPSender::~RTPSender() {}

rtc::ArrayView<const RtpExtensionSize> RTPSender::FecExtensionSizes() {}

rtc::ArrayView<const RtpExtensionSize> RTPSender::VideoExtensionSizes() {}

rtc::ArrayView<const RtpExtensionSize> RTPSender::AudioExtensionSizes() {}

void RTPSender::SetExtmapAllowMixed(bool extmap_allow_mixed) {}

bool RTPSender::RegisterRtpHeaderExtension(absl::string_view uri, int id) {}

bool RTPSender::IsRtpHeaderExtensionRegistered(RTPExtensionType type) const {}

void RTPSender::DeregisterRtpHeaderExtension(absl::string_view uri) {}

void RTPSender::SetMaxRtpPacketSize(size_t max_packet_size) {}

size_t RTPSender::MaxRtpPacketSize() const {}

void RTPSender::SetRtxStatus(int mode) {}

int RTPSender::RtxStatus() const {}

void RTPSender::SetRtxPayloadType(int payload_type,
                                  int associated_payload_type) {}

int32_t RTPSender::ReSendPacket(uint16_t packet_id) {}

void RTPSender::OnReceivedAckOnSsrc(int64_t extended_highest_sequence_number) {}

void RTPSender::OnReceivedAckOnRtxSsrc(
    int64_t extended_highest_sequence_number) {}

void RTPSender::OnReceivedNack(
    const std::vector<uint16_t>& nack_sequence_numbers,
    int64_t avg_rtt) {}

bool RTPSender::SupportsPadding() const {}

bool RTPSender::SupportsRtxPayloadPadding() const {}

std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
    size_t target_size_bytes,
    bool media_has_been_sent,
    bool can_send_padding_on_media_ssrc) {}

void RTPSender::EnqueuePackets(
    std::vector<std::unique_ptr<RtpPacketToSend>> packets) {}

size_t RTPSender::FecOrPaddingPacketMaxRtpHeaderLength() const {}

size_t RTPSender::ExpectedPerPacketOverhead() const {}

std::unique_ptr<RtpPacketToSend> RTPSender::AllocatePacket(
    rtc::ArrayView<const uint32_t> csrcs) {}

size_t RTPSender::RtxPacketOverhead() const {}

void RTPSender::SetSendingMediaStatus(bool enabled) {}

bool RTPSender::SendingMedia() const {}

bool RTPSender::IsAudioConfigured() const {}

void RTPSender::SetTimestampOffset(uint32_t timestamp) {}

uint32_t RTPSender::TimestampOffset() const {}

void RTPSender::SetMid(absl::string_view mid) {}

static void CopyHeaderAndExtensionsToRtxPacket(const RtpPacketToSend& packet,
                                               RtpPacketToSend* rtx_packet) {}

std::unique_ptr<RtpPacketToSend> RTPSender::BuildRtxPacket(
    const RtpPacketToSend& packet) {}

void RTPSender::SetRtpState(const RtpState& rtp_state) {}

RtpState RTPSender::GetRtpState() const {}

void RTPSender::SetRtxRtpState(const RtpState& rtp_state) {}

RtpState RTPSender::GetRtxRtpState() const {}

void RTPSender::UpdateHeaderSizes() {}
}  // namespace webrtc