Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 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 | |
Stefan Holmer | 9416ef8 | 2018-07-19 10:34:38 +0200 | [diff] [blame] | 11 | #ifndef CALL_RTP_VIDEO_SENDER_INTERFACE_H_ |
| 12 | #define CALL_RTP_VIDEO_SENDER_INTERFACE_H_ |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 13 | |
| 14 | #include <map> |
| 15 | #include <vector> |
| 16 | |
Elad Alon | 8b60e8b | 2019-04-08 14:14:05 +0200 | [diff] [blame] | 17 | #include "absl/types/optional.h" |
Elad Alon | 898395d | 2019-04-10 15:55:00 +0200 | [diff] [blame] | 18 | #include "api/array_view.h" |
Sebastian Jansson | 82ed2e8 | 2019-10-15 15:58:37 +0200 | [diff] [blame] | 19 | #include "api/call/bitrate_allocation.h" |
Elad Alon | 8f01c4e | 2019-06-28 15:19:43 +0200 | [diff] [blame] | 20 | #include "api/fec_controller_override.h" |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 21 | #include "call/rtp_config.h" |
| 22 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
Elad Alon | 8b60e8b | 2019-04-08 14:14:05 +0200 | [diff] [blame] | 23 | #include "modules/rtp_rtcp/source/rtp_sequence_number_map.h" |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 24 | #include "modules/utility/include/process_thread.h" |
| 25 | #include "modules/video_coding/include/video_codec_interface.h" |
| 26 | |
| 27 | namespace webrtc { |
| 28 | class VideoBitrateAllocation; |
| 29 | struct FecProtectionParams; |
| 30 | |
Elad Alon | 8f01c4e | 2019-06-28 15:19:43 +0200 | [diff] [blame] | 31 | class RtpVideoSenderInterface : public EncodedImageCallback, |
| 32 | public FecControllerOverride { |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 33 | public: |
| 34 | virtual void RegisterProcessThread(ProcessThread* module_process_thread) = 0; |
| 35 | virtual void DeRegisterProcessThread() = 0; |
| 36 | |
Stefan Holmer | 9416ef8 | 2018-07-19 10:34:38 +0200 | [diff] [blame] | 37 | // RtpVideoSender will only route packets if being active, all |
| 38 | // packets will be dropped otherwise. |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 39 | virtual void SetActive(bool active) = 0; |
| 40 | // Sets the sending status of the rtp modules and appropriately sets the |
Stefan Holmer | 9416ef8 | 2018-07-19 10:34:38 +0200 | [diff] [blame] | 41 | // RtpVideoSender to active if any rtp modules are active. |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 42 | virtual void SetActiveModules(const std::vector<bool> active_modules) = 0; |
| 43 | virtual bool IsActive() = 0; |
| 44 | |
| 45 | virtual void OnNetworkAvailability(bool network_available) = 0; |
| 46 | virtual std::map<uint32_t, RtpState> GetRtpStates() const = 0; |
| 47 | virtual std::map<uint32_t, RtpPayloadState> GetRtpPayloadStates() const = 0; |
| 48 | |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 49 | virtual void DeliverRtcp(const uint8_t* packet, size_t length) = 0; |
| 50 | |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 51 | virtual void OnBitrateAllocationUpdated( |
| 52 | const VideoBitrateAllocation& bitrate) = 0; |
Sebastian Jansson | 82ed2e8 | 2019-10-15 15:58:37 +0200 | [diff] [blame] | 53 | virtual void OnBitrateUpdated(BitrateAllocationUpdate update, |
Stefan Holmer | 64be7fa | 2018-10-04 15:21:55 +0200 | [diff] [blame] | 54 | int framerate) = 0; |
| 55 | virtual void OnTransportOverheadChanged( |
| 56 | size_t transport_overhead_bytes_per_packet) = 0; |
| 57 | virtual uint32_t GetPayloadBitrateBps() const = 0; |
| 58 | virtual uint32_t GetProtectionBitrateBps() const = 0; |
| 59 | virtual void SetEncodingData(size_t width, |
| 60 | size_t height, |
| 61 | size_t num_temporal_layers) = 0; |
Elad Alon | 898395d | 2019-04-10 15:55:00 +0200 | [diff] [blame] | 62 | virtual std::vector<RtpSequenceNumberMap::Info> GetSentRtpPacketInfos( |
Elad Alon | 8b60e8b | 2019-04-08 14:14:05 +0200 | [diff] [blame] | 63 | uint32_t ssrc, |
Elad Alon | 898395d | 2019-04-10 15:55:00 +0200 | [diff] [blame] | 64 | rtc::ArrayView<const uint16_t> sequence_numbers) const = 0; |
Elad Alon | 8f01c4e | 2019-06-28 15:19:43 +0200 | [diff] [blame] | 65 | |
| 66 | // Implements FecControllerOverride. |
| 67 | void SetFecAllowed(bool fec_allowed) override = 0; |
Stefan Holmer | dbdb3a0 | 2018-07-17 16:03:46 +0200 | [diff] [blame] | 68 | }; |
| 69 | } // namespace webrtc |
Stefan Holmer | 9416ef8 | 2018-07-19 10:34:38 +0200 | [diff] [blame] | 70 | #endif // CALL_RTP_VIDEO_SENDER_INTERFACE_H_ |