xref: /aosp_15_r20/external/webrtc/call/rtp_video_sender_interface.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
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 
11 #ifndef CALL_RTP_VIDEO_SENDER_INTERFACE_H_
12 #define CALL_RTP_VIDEO_SENDER_INTERFACE_H_
13 
14 #include <map>
15 #include <vector>
16 
17 #include "absl/types/optional.h"
18 #include "api/array_view.h"
19 #include "api/call/bitrate_allocation.h"
20 #include "api/fec_controller_override.h"
21 #include "api/video/video_layers_allocation.h"
22 #include "call/rtp_config.h"
23 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
24 #include "modules/rtp_rtcp/source/rtp_sequence_number_map.h"
25 #include "modules/video_coding/include/video_codec_interface.h"
26 
27 namespace webrtc {
28 class VideoBitrateAllocation;
29 struct FecProtectionParams;
30 
31 class RtpVideoSenderInterface : public EncodedImageCallback,
32                                 public FecControllerOverride {
33  public:
34   // Sets the sending status of the rtp modules and appropriately sets the
35   // RtpVideoSender to active if any rtp modules are active.
36   // A module will only send packet if beeing active.
37   virtual void SetActiveModules(const std::vector<bool>& active_modules) = 0;
38   // Set the sending status of all rtp modules to inactive.
39   virtual void Stop() = 0;
40   virtual bool IsActive() = 0;
41 
42   virtual void OnNetworkAvailability(bool network_available) = 0;
43   virtual std::map<uint32_t, RtpState> GetRtpStates() const = 0;
44   virtual std::map<uint32_t, RtpPayloadState> GetRtpPayloadStates() const = 0;
45 
46   virtual void DeliverRtcp(const uint8_t* packet, size_t length) = 0;
47 
48   virtual void OnBitrateAllocationUpdated(
49       const VideoBitrateAllocation& bitrate) = 0;
50   virtual void OnVideoLayersAllocationUpdated(
51       const VideoLayersAllocation& allocation) = 0;
52   virtual void OnBitrateUpdated(BitrateAllocationUpdate update,
53                                 int framerate) = 0;
54   virtual void OnTransportOverheadChanged(
55       size_t transport_overhead_bytes_per_packet) = 0;
56   virtual uint32_t GetPayloadBitrateBps() const = 0;
57   virtual uint32_t GetProtectionBitrateBps() const = 0;
58   virtual void SetEncodingData(size_t width,
59                                size_t height,
60                                size_t num_temporal_layers) = 0;
61   virtual std::vector<RtpSequenceNumberMap::Info> GetSentRtpPacketInfos(
62       uint32_t ssrc,
63       rtc::ArrayView<const uint16_t> sequence_numbers) const = 0;
64 
65   // Implements FecControllerOverride.
66   void SetFecAllowed(bool fec_allowed) override = 0;
67 };
68 }  // namespace webrtc
69 #endif  // CALL_RTP_VIDEO_SENDER_INTERFACE_H_
70