blob: 72e544e7ece12d68ce4c9a5eea3cb22de53038bc [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,
28 public ReceiveStream {
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 Stats {
33 std::string ToString(int64_t time_ms) const;
brandtr76648da2016-10-20 04:54:48 -070034
brandtr7250b392016-12-19 01:13:46 -080035 // TODO(brandtr): Add appropriate stats here.
36 int flexfec_bitrate_bps;
37 };
brandtr76648da2016-10-20 04:54:48 -070038
brandtr7250b392016-12-19 01:13:46 -080039 struct Config {
Paulina Hensman11b34f42018-04-09 14:24:52 +020040 explicit Config(Transport* rtcp_send_transport);
Mirko Bonadei8fdcac32018-08-28 16:30:18 +020041 Config(const Config&);
Paulina Hensman11b34f42018-04-09 14:24:52 +020042 ~Config();
brandtr8313a6f2017-01-13 07:41:19 -080043
brandtr7250b392016-12-19 01:13:46 -080044 std::string ToString() const;
brandtr76648da2016-10-20 04:54:48 -070045
brandtr8313a6f2017-01-13 07:41:19 -080046 // Returns true if all RTP information is available in order to
47 // enable receiving FlexFEC.
48 bool IsCompleteAndEnabled() const;
49
brandtr7250b392016-12-19 01:13:46 -080050 // Payload type for FlexFEC.
51 int payload_type = -1;
brandtr76648da2016-10-20 04:54:48 -070052
Tommi1c1f5402021-06-14 10:54:20 +020053 RtpConfig rtp;
brandtr7250b392016-12-19 01:13:46 -080054
55 // Vector containing a single element, corresponding to the SSRC of the
56 // media stream being protected by this FlexFEC stream. The vector MUST have
57 // size 1.
58 //
59 // TODO(brandtr): Update comment above when we support multistream
60 // protection.
61 std::vector<uint32_t> protected_media_ssrcs;
62
brandtr7250b392016-12-19 01:13:46 -080063 // What RTCP mode to use in the reports.
64 RtcpMode rtcp_mode = RtcpMode::kCompound;
65
66 // Transport for outgoing RTCP packets.
67 Transport* rtcp_send_transport = nullptr;
brandtr7250b392016-12-19 01:13:46 -080068 };
69
brandtr7250b392016-12-19 01:13:46 -080070 virtual Stats GetStats() const = 0;
brandtr76648da2016-10-20 04:54:48 -070071};
72
brandtr76648da2016-10-20 04:54:48 -070073} // namespace webrtc
74
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020075#endif // CALL_FLEXFEC_RECEIVE_STREAM_H_