brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef CALL_FLEXFEC_RECEIVE_STREAM_H_ |
| 12 | #define CALL_FLEXFEC_RECEIVE_STREAM_H_ |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 13 | |
pbos | c7c26a0 | 2017-01-02 16:42:32 | [diff] [blame] | 14 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 17:08:33 | [diff] [blame] | 15 | |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 16 | #include <string> |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 17 | #include <vector> |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 18 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 19 | #include "api/call/transport.h" |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 20 | #include "api/rtp_headers.h" |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 21 | #include "api/rtp_parameters.h" |
Tommi | 1c1f540 | 2021-06-14 08:54:20 | [diff] [blame] | 22 | #include "call/receive_stream.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 23 | #include "call/rtp_packet_sink_interface.h" |
Philipp Hancke | 17e8a5c | 2023-06-21 11:53:41 | [diff] [blame] | 24 | #include "modules/rtp_rtcp/include/receive_statistics.h" |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 25 | |
| 26 | namespace webrtc { |
| 27 | |
Tommi | 1c1f540 | 2021-06-14 08:54:20 | [diff] [blame] | 28 | class FlexfecReceiveStream : public RtpPacketSinkInterface, |
Tommi | 0601db9 | 2022-05-18 07:18:37 | [diff] [blame] | 29 | public ReceiveStreamInterface { |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 30 | public: |
eladalon | c0d481a | 2017-08-02 14:39:07 | [diff] [blame] | 31 | ~FlexfecReceiveStream() override = default; |
eladalon | 42f44f9 | 2017-07-25 13:40:06 | [diff] [blame] | 32 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 33 | struct Config { |
Paulina Hensman | 11b34f4 | 2018-04-09 12:24:52 | [diff] [blame] | 34 | explicit Config(Transport* rtcp_send_transport); |
Mirko Bonadei | 8fdcac3 | 2018-08-28 14:30:18 | [diff] [blame] | 35 | Config(const Config&); |
Paulina Hensman | 11b34f4 | 2018-04-09 12:24:52 | [diff] [blame] | 36 | ~Config(); |
brandtr | 8313a6f | 2017-01-13 15:41:19 | [diff] [blame] | 37 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 38 | std::string ToString() const; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 39 | |
brandtr | 8313a6f | 2017-01-13 15:41:19 | [diff] [blame] | 40 | // Returns true if all RTP information is available in order to |
| 41 | // enable receiving FlexFEC. |
| 42 | bool IsCompleteAndEnabled() const; |
| 43 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 44 | // Payload type for FlexFEC. |
| 45 | int payload_type = -1; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 46 | |
Tommi | 7a15ff3 | 2022-05-09 18:54:02 | [diff] [blame] | 47 | ReceiveStreamRtpConfig rtp; |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 48 | |
| 49 | // Vector containing a single element, corresponding to the SSRC of the |
| 50 | // media stream being protected by this FlexFEC stream. The vector MUST have |
| 51 | // size 1. |
| 52 | // |
| 53 | // TODO(brandtr): Update comment above when we support multistream |
| 54 | // protection. |
| 55 | std::vector<uint32_t> protected_media_ssrcs; |
| 56 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 57 | // What RTCP mode to use in the reports. |
| 58 | RtcpMode rtcp_mode = RtcpMode::kCompound; |
| 59 | |
| 60 | // Transport for outgoing RTCP packets. |
| 61 | Transport* rtcp_send_transport = nullptr; |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 62 | }; |
Tommi | aeb4412 | 2022-07-14 16:33:42 | [diff] [blame] | 63 | |
| 64 | // TODO(tommi): FlexfecReceiveStream inherits from ReceiveStreamInterface, |
| 65 | // not VideoReceiveStreamInterface where there's also a SetRtcpMode method. |
| 66 | // Perhaps this should be in ReceiveStreamInterface and apply to audio streams |
| 67 | // as well (although there's no logic that would use it at present). |
| 68 | virtual void SetRtcpMode(RtcpMode mode) = 0; |
Tommi | 43b15c3 | 2022-07-28 07:24:52 | [diff] [blame] | 69 | |
| 70 | // Called to change the payload type after initialization. |
| 71 | virtual void SetPayloadType(int payload_type) = 0; |
| 72 | virtual int payload_type() const = 0; |
Philipp Hancke | 17e8a5c | 2023-06-21 11:53:41 | [diff] [blame] | 73 | |
| 74 | virtual const ReceiveStatistics* GetStats() const = 0; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 75 | }; |
| 76 | |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 77 | } // namespace webrtc |
| 78 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 79 | #endif // CALL_FLEXFEC_RECEIVE_STREAM_H_ |