blob: a0b7a11d3a42a0b12d2760c853ed83a406eccc34 [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>
15
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"
20#include "api/rtpparameters.h"
21#include "call/rtp_packet_sink_interface.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020022#include "common_types.h" // NOLINT(build/include)
brandtr76648da2016-10-20 04:54:48 -070023
24namespace webrtc {
25
eladalonc0d481a2017-08-02 07:39:07 -070026class FlexfecReceiveStream : public RtpPacketSinkInterface {
brandtr76648da2016-10-20 04:54:48 -070027 public:
eladalonc0d481a2017-08-02 07:39:07 -070028 ~FlexfecReceiveStream() override = default;
eladalon42f44f92017-07-25 06:40:06 -070029
brandtr7250b392016-12-19 01:13:46 -080030 struct Stats {
31 std::string ToString(int64_t time_ms) const;
brandtr76648da2016-10-20 04:54:48 -070032
brandtr7250b392016-12-19 01:13:46 -080033 // TODO(brandtr): Add appropriate stats here.
34 int flexfec_bitrate_bps;
35 };
brandtr76648da2016-10-20 04:54:48 -070036
brandtr7250b392016-12-19 01:13:46 -080037 struct Config {
brandtr8313a6f2017-01-13 07:41:19 -080038 explicit Config(Transport* rtcp_send_transport)
39 : rtcp_send_transport(rtcp_send_transport) {
40 RTC_DCHECK(rtcp_send_transport);
41 }
42
brandtr7250b392016-12-19 01:13:46 -080043 std::string ToString() const;
brandtr76648da2016-10-20 04:54:48 -070044
brandtr8313a6f2017-01-13 07:41:19 -080045 // Returns true if all RTP information is available in order to
46 // enable receiving FlexFEC.
47 bool IsCompleteAndEnabled() const;
48
brandtr7250b392016-12-19 01:13:46 -080049 // Payload type for FlexFEC.
50 int payload_type = -1;
brandtr76648da2016-10-20 04:54:48 -070051
brandtr7250b392016-12-19 01:13:46 -080052 // SSRC for FlexFEC stream to be received.
53 uint32_t remote_ssrc = 0;
54
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
63 // SSRC for RTCP reports to be sent.
64 uint32_t local_ssrc = 0;
65
66 // What RTCP mode to use in the reports.
67 RtcpMode rtcp_mode = RtcpMode::kCompound;
68
69 // Transport for outgoing RTCP packets.
70 Transport* rtcp_send_transport = nullptr;
71
72 // |transport_cc| is true whenever the send-side BWE RTCP feedback message
73 // has been negotiated. This is a prerequisite for enabling send-side BWE.
74 bool transport_cc = false;
75
76 // RTP header extensions that have been negotiated for this track.
brandtrb29e6522016-12-21 06:37:18 -080077 std::vector<RtpExtension> rtp_header_extensions;
brandtr7250b392016-12-19 01:13:46 -080078 };
79
brandtr7250b392016-12-19 01:13:46 -080080 virtual Stats GetStats() const = 0;
81
eladalon42f44f92017-07-25 06:40:06 -070082 virtual const Config& GetConfig() const = 0;
brandtr76648da2016-10-20 04:54:48 -070083};
84
brandtr76648da2016-10-20 04:54:48 -070085} // namespace webrtc
86
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020087#endif // CALL_FLEXFEC_RECEIVE_STREAM_H_