blob: 632c9e835a2749e3fb9e93482592399309e482e6 [file] [log] [blame]
Stefan Holmerdbdb3a02018-07-17 16:03:46 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Stefan Holmer9416ef82018-07-19 10:34:38 +020011#ifndef CALL_RTP_VIDEO_SENDER_INTERFACE_H_
12#define CALL_RTP_VIDEO_SENDER_INTERFACE_H_
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020013
14#include <map>
15#include <vector>
16
Elad Alon8b60e8b2019-04-08 14:14:05 +020017#include "absl/types/optional.h"
Elad Alon898395d2019-04-10 15:55:00 +020018#include "api/array_view.h"
Sebastian Jansson82ed2e82019-10-15 15:58:37 +020019#include "api/call/bitrate_allocation.h"
Elad Alon8f01c4e2019-06-28 15:19:43 +020020#include "api/fec_controller_override.h"
Per Kjellanderaf704182020-10-16 10:30:40 +020021#include "api/video/video_layers_allocation.h"
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020022#include "call/rtp_config.h"
23#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Elad Alon8b60e8b2019-04-08 14:14:05 +020024#include "modules/rtp_rtcp/source/rtp_sequence_number_map.h"
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020025#include "modules/utility/include/process_thread.h"
26#include "modules/video_coding/include/video_codec_interface.h"
27
28namespace webrtc {
29class VideoBitrateAllocation;
30struct FecProtectionParams;
31
Elad Alon8f01c4e2019-06-28 15:19:43 +020032class RtpVideoSenderInterface : public EncodedImageCallback,
33 public FecControllerOverride {
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020034 public:
35 virtual void RegisterProcessThread(ProcessThread* module_process_thread) = 0;
36 virtual void DeRegisterProcessThread() = 0;
37
Stefan Holmer9416ef82018-07-19 10:34:38 +020038 // RtpVideoSender will only route packets if being active, all
39 // packets will be dropped otherwise.
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020040 virtual void SetActive(bool active) = 0;
41 // Sets the sending status of the rtp modules and appropriately sets the
Stefan Holmer9416ef82018-07-19 10:34:38 +020042 // RtpVideoSender to active if any rtp modules are active.
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020043 virtual void SetActiveModules(const std::vector<bool> active_modules) = 0;
44 virtual bool IsActive() = 0;
45
46 virtual void OnNetworkAvailability(bool network_available) = 0;
47 virtual std::map<uint32_t, RtpState> GetRtpStates() const = 0;
48 virtual std::map<uint32_t, RtpPayloadState> GetRtpPayloadStates() const = 0;
49
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020050 virtual void DeliverRtcp(const uint8_t* packet, size_t length) = 0;
51
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020052 virtual void OnBitrateAllocationUpdated(
53 const VideoBitrateAllocation& bitrate) = 0;
Per Kjellanderaf704182020-10-16 10:30:40 +020054 virtual void OnVideoLayersAllocationUpdated(
55 const VideoLayersAllocation& allocation) = 0;
Sebastian Jansson82ed2e82019-10-15 15:58:37 +020056 virtual void OnBitrateUpdated(BitrateAllocationUpdate update,
Stefan Holmer64be7fa2018-10-04 15:21:55 +020057 int framerate) = 0;
58 virtual void OnTransportOverheadChanged(
59 size_t transport_overhead_bytes_per_packet) = 0;
60 virtual uint32_t GetPayloadBitrateBps() const = 0;
61 virtual uint32_t GetProtectionBitrateBps() const = 0;
62 virtual void SetEncodingData(size_t width,
63 size_t height,
64 size_t num_temporal_layers) = 0;
Elad Alon898395d2019-04-10 15:55:00 +020065 virtual std::vector<RtpSequenceNumberMap::Info> GetSentRtpPacketInfos(
Elad Alon8b60e8b2019-04-08 14:14:05 +020066 uint32_t ssrc,
Elad Alon898395d2019-04-10 15:55:00 +020067 rtc::ArrayView<const uint16_t> sequence_numbers) const = 0;
Elad Alon8f01c4e2019-06-28 15:19:43 +020068
69 // Implements FecControllerOverride.
70 void SetFecAllowed(bool fec_allowed) override = 0;
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020071};
72} // namespace webrtc
Stefan Holmer9416ef82018-07-19 10:34:38 +020073#endif // CALL_RTP_VIDEO_SENDER_INTERFACE_H_