blob: 949ad742aa03f66d721ab50b875e1bcbaf5b3a29 [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>
brandtr76648da2016-10-20 04:54:48 -070015#include <string>
brandtr7250b392016-12-19 01:13:46 -080016#include <vector>
brandtr76648da2016-10-20 04:54:48 -070017
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "api/call/transport.h"
Yves Gerey665174f2018-06-19 15:03:05 +020019#include "api/rtp_headers.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "api/rtpparameters.h"
21#include "call/rtp_packet_sink_interface.h"
brandtr76648da2016-10-20 04:54:48 -070022
23namespace webrtc {
24
eladalonc0d481a2017-08-02 07:39:07 -070025class FlexfecReceiveStream : public RtpPacketSinkInterface {
brandtr76648da2016-10-20 04:54:48 -070026 public:
eladalonc0d481a2017-08-02 07:39:07 -070027 ~FlexfecReceiveStream() override = default;
eladalon42f44f92017-07-25 06:40:06 -070028
brandtr7250b392016-12-19 01:13:46 -080029 struct Stats {
30 std::string ToString(int64_t time_ms) const;
brandtr76648da2016-10-20 04:54:48 -070031
brandtr7250b392016-12-19 01:13:46 -080032 // TODO(brandtr): Add appropriate stats here.
33 int flexfec_bitrate_bps;
34 };
brandtr76648da2016-10-20 04:54:48 -070035
brandtr7250b392016-12-19 01:13:46 -080036 struct Config {
Paulina Hensman11b34f42018-04-09 14:24:52 +020037 explicit Config(Transport* rtcp_send_transport);
Mirko Bonadei8fdcac32018-08-28 16:30:18 +020038 Config(const Config&);
Paulina Hensman11b34f42018-04-09 14:24:52 +020039 ~Config();
brandtr8313a6f2017-01-13 07:41:19 -080040
brandtr7250b392016-12-19 01:13:46 -080041 std::string ToString() const;
brandtr76648da2016-10-20 04:54:48 -070042
brandtr8313a6f2017-01-13 07:41:19 -080043 // Returns true if all RTP information is available in order to
44 // enable receiving FlexFEC.
45 bool IsCompleteAndEnabled() const;
46
brandtr7250b392016-12-19 01:13:46 -080047 // Payload type for FlexFEC.
48 int payload_type = -1;
brandtr76648da2016-10-20 04:54:48 -070049
brandtr7250b392016-12-19 01:13:46 -080050 // SSRC for FlexFEC stream to be received.
51 uint32_t remote_ssrc = 0;
52
53 // Vector containing a single element, corresponding to the SSRC of the
54 // media stream being protected by this FlexFEC stream. The vector MUST have
55 // size 1.
56 //
57 // TODO(brandtr): Update comment above when we support multistream
58 // protection.
59 std::vector<uint32_t> protected_media_ssrcs;
60
61 // SSRC for RTCP reports to be sent.
62 uint32_t local_ssrc = 0;
63
64 // What RTCP mode to use in the reports.
65 RtcpMode rtcp_mode = RtcpMode::kCompound;
66
67 // Transport for outgoing RTCP packets.
68 Transport* rtcp_send_transport = nullptr;
69
70 // |transport_cc| is true whenever the send-side BWE RTCP feedback message
71 // has been negotiated. This is a prerequisite for enabling send-side BWE.
72 bool transport_cc = false;
73
74 // RTP header extensions that have been negotiated for this track.
brandtrb29e6522016-12-21 06:37:18 -080075 std::vector<RtpExtension> rtp_header_extensions;
brandtr7250b392016-12-19 01:13:46 -080076 };
77
brandtr7250b392016-12-19 01:13:46 -080078 virtual Stats GetStats() const = 0;
79
eladalon42f44f92017-07-25 06:40:06 -070080 virtual const Config& GetConfig() const = 0;
brandtr76648da2016-10-20 04:54:48 -070081};
82
brandtr76648da2016-10-20 04:54:48 -070083} // namespace webrtc
84
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020085#endif // CALL_FLEXFEC_RECEIVE_STREAM_H_