blob: 4f6fe44afabe5310450c22d2ef1dfee1071c0b15 [file] [log] [blame]
brandtr76648da2016-10-20 04:54:48 -07001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef CALL_FLEXFEC_RECEIVE_STREAM_H_
12#define CALL_FLEXFEC_RECEIVE_STREAM_H_
brandtr76648da2016-10-20 04:54:48 -070013
pbosc7c26a02017-01-02 08:42:32 -080014#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020015
brandtr76648da2016-10-20 04:54:48 -070016#include <string>
brandtr7250b392016-12-19 01:13:46 -080017#include <vector>
brandtr76648da2016-10-20 04:54:48 -070018
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "api/call/transport.h"
Yves Gerey665174f2018-06-19 15:03:05 +020020#include "api/rtp_headers.h"
Steve Anton10542f22019-01-11 09:11:00 -080021#include "api/rtp_parameters.h"
Tommi1c1f5402021-06-14 10:54:20 +020022#include "call/receive_stream.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020023#include "call/rtp_packet_sink_interface.h"
brandtr76648da2016-10-20 04:54:48 -070024
25namespace webrtc {
26
Tommi1c1f5402021-06-14 10:54:20 +020027class FlexfecReceiveStream : public RtpPacketSinkInterface,
Tommi0601db92022-05-18 09:18:37 +020028 public ReceiveStreamInterface {
brandtr76648da2016-10-20 04:54:48 -070029 public:
eladalonc0d481a2017-08-02 07:39:07 -070030 ~FlexfecReceiveStream() override = default;
eladalon42f44f92017-07-25 06:40:06 -070031
brandtr7250b392016-12-19 01:13:46 -080032 struct Config {
Paulina Hensman11b34f42018-04-09 14:24:52 +020033 explicit Config(Transport* rtcp_send_transport);
Mirko Bonadei8fdcac32018-08-28 16:30:18 +020034 Config(const Config&);
Paulina Hensman11b34f42018-04-09 14:24:52 +020035 ~Config();
brandtr8313a6f2017-01-13 07:41:19 -080036
brandtr7250b392016-12-19 01:13:46 -080037 std::string ToString() const;
brandtr76648da2016-10-20 04:54:48 -070038
brandtr8313a6f2017-01-13 07:41:19 -080039 // Returns true if all RTP information is available in order to
40 // enable receiving FlexFEC.
41 bool IsCompleteAndEnabled() const;
42
brandtr7250b392016-12-19 01:13:46 -080043 // Payload type for FlexFEC.
44 int payload_type = -1;
brandtr76648da2016-10-20 04:54:48 -070045
Tommi7a15ff32022-05-09 18:54:02 +000046 ReceiveStreamRtpConfig rtp;
brandtr7250b392016-12-19 01:13:46 -080047
48 // Vector containing a single element, corresponding to the SSRC of the
49 // media stream being protected by this FlexFEC stream. The vector MUST have
50 // size 1.
51 //
52 // TODO(brandtr): Update comment above when we support multistream
53 // protection.
54 std::vector<uint32_t> protected_media_ssrcs;
55
brandtr7250b392016-12-19 01:13:46 -080056 // What RTCP mode to use in the reports.
57 RtcpMode rtcp_mode = RtcpMode::kCompound;
58
59 // Transport for outgoing RTCP packets.
60 Transport* rtcp_send_transport = nullptr;
brandtr7250b392016-12-19 01:13:46 -080061 };
Tommiaeb44122022-07-14 18:33:42 +020062
63 // TODO(tommi): FlexfecReceiveStream inherits from ReceiveStreamInterface,
64 // not VideoReceiveStreamInterface where there's also a SetRtcpMode method.
65 // Perhaps this should be in ReceiveStreamInterface and apply to audio streams
66 // as well (although there's no logic that would use it at present).
67 virtual void SetRtcpMode(RtcpMode mode) = 0;
Tommi43b15c32022-07-28 09:24:52 +020068
69 // Called to change the payload type after initialization.
70 virtual void SetPayloadType(int payload_type) = 0;
71 virtual int payload_type() const = 0;
brandtr76648da2016-10-20 04:54:48 -070072};
73
brandtr76648da2016-10-20 04:54:48 -070074} // namespace webrtc
75
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020076#endif // CALL_FLEXFEC_RECEIVE_STREAM_H_