brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [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 | c7c26a0 | 2017-01-02 08:42:32 -0800 | [diff] [blame] | 14 | #include <stdint.h> |
| 15 | |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 16 | #include <string> |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 17 | #include <vector> |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 18 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 19 | #include "webrtc/api/call/transport.h" |
| 20 | #include "webrtc/config.h" |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 24 | class FlexfecReceiveStream { |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 25 | public: |
eladalon | 42f44f9 | 2017-07-25 06:40:06 -0700 | [diff] [blame] | 26 | virtual ~FlexfecReceiveStream() = default; |
| 27 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 28 | struct Stats { |
| 29 | std::string ToString(int64_t time_ms) const; |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 30 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 31 | // TODO(brandtr): Add appropriate stats here. |
| 32 | int flexfec_bitrate_bps; |
| 33 | }; |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 34 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 35 | struct Config { |
brandtr | 8313a6f | 2017-01-13 07:41:19 -0800 | [diff] [blame] | 36 | explicit Config(Transport* rtcp_send_transport) |
| 37 | : rtcp_send_transport(rtcp_send_transport) { |
| 38 | RTC_DCHECK(rtcp_send_transport); |
| 39 | } |
| 40 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 41 | std::string ToString() const; |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 42 | |
brandtr | 8313a6f | 2017-01-13 07:41:19 -0800 | [diff] [blame] | 43 | // Returns true if all RTP information is available in order to |
| 44 | // enable receiving FlexFEC. |
| 45 | bool IsCompleteAndEnabled() const; |
| 46 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 47 | // Payload type for FlexFEC. |
| 48 | int payload_type = -1; |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 49 | |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 50 | // 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. |
brandtr | b29e652 | 2016-12-21 06:37:18 -0800 | [diff] [blame] | 75 | std::vector<RtpExtension> rtp_header_extensions; |
brandtr | 7250b39 | 2016-12-19 01:13:46 -0800 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | // Starts stream activity. |
| 79 | // When a stream is active, it can receive and process packets. |
| 80 | virtual void Start() = 0; |
| 81 | // Stops stream activity. |
| 82 | // When a stream is stopped, it can't receive nor process packets. |
| 83 | virtual void Stop() = 0; |
| 84 | |
| 85 | virtual Stats GetStats() const = 0; |
| 86 | |
eladalon | 42f44f9 | 2017-07-25 06:40:06 -0700 | [diff] [blame] | 87 | virtual const Config& GetConfig() const = 0; |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
brandtr | 76648da | 2016-10-20 04:54:48 -0700 | [diff] [blame] | 90 | } // namespace webrtc |
| 91 | |
| 92 | #endif // WEBRTC_CALL_FLEXFEC_RECEIVE_STREAM_H_ |