blob: befa7dccb6f73d41ae2ab9b0087631e29fc25c1d [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
11#ifndef WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_
12#define WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_
13
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
brandtr7250b392016-12-19 01:13:46 -080019#include "webrtc/api/call/transport.h"
eladalonc0d481a2017-08-02 07:39:07 -070020#include "webrtc/call/rtp_packet_sink_interface.h"
brandtr7250b392016-12-19 01:13:46 -080021#include "webrtc/config.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 {
brandtr8313a6f2017-01-13 07:41:19 -080037 explicit Config(Transport* rtcp_send_transport)
38 : rtcp_send_transport(rtcp_send_transport) {
39 RTC_DCHECK(rtcp_send_transport);
40 }
41
brandtr7250b392016-12-19 01:13:46 -080042 std::string ToString() const;
brandtr76648da2016-10-20 04:54:48 -070043
brandtr8313a6f2017-01-13 07:41:19 -080044 // Returns true if all RTP information is available in order to
45 // enable receiving FlexFEC.
46 bool IsCompleteAndEnabled() const;
47
brandtr7250b392016-12-19 01:13:46 -080048 // Payload type for FlexFEC.
49 int payload_type = -1;
brandtr76648da2016-10-20 04:54:48 -070050
brandtr7250b392016-12-19 01:13:46 -080051 // SSRC for FlexFEC stream to be received.
52 uint32_t remote_ssrc = 0;
53
54 // Vector containing a single element, corresponding to the SSRC of the
55 // media stream being protected by this FlexFEC stream. The vector MUST have
56 // size 1.
57 //
58 // TODO(brandtr): Update comment above when we support multistream
59 // protection.
60 std::vector<uint32_t> protected_media_ssrcs;
61
62 // SSRC for RTCP reports to be sent.
63 uint32_t local_ssrc = 0;
64
65 // What RTCP mode to use in the reports.
66 RtcpMode rtcp_mode = RtcpMode::kCompound;
67
68 // Transport for outgoing RTCP packets.
69 Transport* rtcp_send_transport = nullptr;
70
71 // |transport_cc| is true whenever the send-side BWE RTCP feedback message
72 // has been negotiated. This is a prerequisite for enabling send-side BWE.
73 bool transport_cc = false;
74
75 // RTP header extensions that have been negotiated for this track.
brandtrb29e6522016-12-21 06:37:18 -080076 std::vector<RtpExtension> rtp_header_extensions;
brandtr7250b392016-12-19 01:13:46 -080077 };
78
79 // Starts stream activity.
80 // When a stream is active, it can receive and process packets.
81 virtual void Start() = 0;
82 // Stops stream activity.
83 // When a stream is stopped, it can't receive nor process packets.
84 virtual void Stop() = 0;
85
86 virtual Stats GetStats() const = 0;
87
eladalon42f44f92017-07-25 06:40:06 -070088 virtual const Config& GetConfig() const = 0;
brandtr76648da2016-10-20 04:54:48 -070089};
90
brandtr76648da2016-10-20 04:54:48 -070091} // namespace webrtc
92
93#endif // WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_