brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef CALL_FLEXFEC_RECEIVE_STREAM_H_ |
| 12 | #define CALL_FLEXFEC_RECEIVE_STREAM_H_ |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 13 | |
pbos | c7c26a0 | 2017-01-02 16:42:32 | [diff] [blame] | 14 | #include <stdint.h> |
| 15 | |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 16 | #include <string> |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 17 | #include <vector> |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 18 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 19 | #include "api/call/transport.h" |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 20 | #include "api/rtp_headers.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 21 | #include "api/rtpparameters.h" |
| 22 | #include "call/rtp_packet_sink_interface.h" |
Mirko Bonadei | 7120742 | 2017-09-15 11:58:09 | [diff] [blame] | 23 | #include "common_types.h" // NOLINT(build/include) |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
| 26 | |
eladalon | c0d481a | 2017-08-02 14:39:07 | [diff] [blame] | 27 | class FlexfecReceiveStream : public RtpPacketSinkInterface { |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 28 | public: |
eladalon | c0d481a | 2017-08-02 14:39:07 | [diff] [blame] | 29 | ~FlexfecReceiveStream() override = default; |
eladalon | 42f44f9 | 2017-07-25 13:40:06 | [diff] [blame] | 30 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 31 | struct Stats { |
| 32 | std::string ToString(int64_t time_ms) const; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 33 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 34 | // TODO(brandtr): Add appropriate stats here. |
| 35 | int flexfec_bitrate_bps; |
| 36 | }; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 37 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 38 | struct Config { |
Paulina Hensman | 11b34f4 | 2018-04-09 12:24:52 | [diff] [blame] | 39 | explicit Config(Transport* rtcp_send_transport); |
| 40 | ~Config(); |
brandtr | 8313a6f | 2017-01-13 15:41:19 | [diff] [blame] | 41 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 42 | std::string ToString() const; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 43 | |
brandtr | 8313a6f | 2017-01-13 15:41:19 | [diff] [blame] | 44 | // Returns true if all RTP information is available in order to |
| 45 | // enable receiving FlexFEC. |
| 46 | bool IsCompleteAndEnabled() const; |
| 47 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 48 | // Payload type for FlexFEC. |
| 49 | int payload_type = -1; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 50 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 51 | // 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. |
brandtr | b29e652 | 2016-12-21 14:37:18 | [diff] [blame] | 76 | std::vector<RtpExtension> rtp_header_extensions; |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 77 | }; |
| 78 | |
brandtr | 7250b39 | 2016-12-19 09:13:46 | [diff] [blame] | 79 | virtual Stats GetStats() const = 0; |
| 80 | |
eladalon | 42f44f9 | 2017-07-25 13:40:06 | [diff] [blame] | 81 | virtual const Config& GetConfig() const = 0; |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 82 | }; |
| 83 | |
brandtr | 76648da | 2016-10-20 11:54:48 | [diff] [blame] | 84 | } // namespace webrtc |
| 85 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 86 | #endif // CALL_FLEXFEC_RECEIVE_STREAM_H_ |