brandtr | 4e97439 | 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 | |
| 11 | #ifndef WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_ |
| 12 | #define WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_ |
| 13 | |
pbos | 67d12ed | 2017-01-02 16:42:32 | [diff] [blame] | 14 | #include <stdint.h> |
| 15 | |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 16 | #include <string> |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 17 | #include <vector> |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 18 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 19 | #include "webrtc/api/call/transport.h" |
Stefan Holmer | 36189cd | 2017-09-01 13:29:28 | [diff] [blame] | 20 | #include "webrtc/api/rtpparameters.h" |
eladalon | 2c1cbc1 | 2017-08-02 14:39:07 | [diff] [blame] | 21 | #include "webrtc/call/rtp_packet_sink_interface.h" |
Stefan Holmer | 36189cd | 2017-09-01 13:29:28 | [diff] [blame] | 22 | #include "webrtc/common_types.h" |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 23 | |
| 24 | namespace webrtc { |
| 25 | |
eladalon | 2c1cbc1 | 2017-08-02 14:39:07 | [diff] [blame] | 26 | class FlexfecReceiveStream : public RtpPacketSinkInterface { |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 27 | public: |
eladalon | 2c1cbc1 | 2017-08-02 14:39:07 | [diff] [blame] | 28 | ~FlexfecReceiveStream() override = default; |
eladalon | 0dedc27 | 2017-07-25 13:40:06 | [diff] [blame] | 29 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 30 | struct Stats { |
| 31 | std::string ToString(int64_t time_ms) const; |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 32 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 33 | // TODO(brandtr): Add appropriate stats here. |
| 34 | int flexfec_bitrate_bps; |
| 35 | }; |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 36 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 37 | struct Config { |
brandtr | b9af9fd | 2017-01-13 15:41:19 | [diff] [blame] | 38 | explicit Config(Transport* rtcp_send_transport) |
| 39 | : rtcp_send_transport(rtcp_send_transport) { |
| 40 | RTC_DCHECK(rtcp_send_transport); |
| 41 | } |
| 42 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 43 | std::string ToString() const; |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 44 | |
brandtr | b9af9fd | 2017-01-13 15:41:19 | [diff] [blame] | 45 | // Returns true if all RTP information is available in order to |
| 46 | // enable receiving FlexFEC. |
| 47 | bool IsCompleteAndEnabled() const; |
| 48 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 49 | // Payload type for FlexFEC. |
| 50 | int payload_type = -1; |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 51 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 52 | // 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. |
brandtr | 909d383 | 2016-12-21 14:37:18 | [diff] [blame] | 77 | std::vector<RtpExtension> rtp_header_extensions; |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 78 | }; |
| 79 | |
brandtr | 02a6431 | 2016-12-19 09:13:46 | [diff] [blame] | 80 | virtual Stats GetStats() const = 0; |
| 81 | |
eladalon | 0dedc27 | 2017-07-25 13:40:06 | [diff] [blame] | 82 | virtual const Config& GetConfig() const = 0; |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 83 | }; |
| 84 | |
brandtr | 4e97439 | 2016-10-20 11:54:48 | [diff] [blame] | 85 | } // namespace webrtc |
| 86 | |
| 87 | #endif // WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_ |