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 CALL_FLEXFEC_RECEIVE_STREAM_H_ 12 #define CALL_FLEXFEC_RECEIVE_STREAM_H_ 13 14 #include <stdint.h> 15 16 #include <string> 17 #include <vector> 18 19 #include "api/call/transport.h" 20 #include "api/rtp_headers.h" 21 #include "api/rtp_parameters.h" 22 #include "call/receive_stream.h" 23 #include "call/rtp_packet_sink_interface.h" 24 25 namespace webrtc { 26 27 class FlexfecReceiveStream : public RtpPacketSinkInterface, 28 public ReceiveStreamInterface { 29 public: 30 ~FlexfecReceiveStream() override = default; 31 32 struct Config { 33 explicit Config(Transport* rtcp_send_transport); 34 Config(const Config&); 35 ~Config(); 36 37 std::string ToString() const; 38 39 // Returns true if all RTP information is available in order to 40 // enable receiving FlexFEC. 41 bool IsCompleteAndEnabled() const; 42 43 // Payload type for FlexFEC. 44 int payload_type = -1; 45 46 ReceiveStreamRtpConfig rtp; 47 48 // Vector containing a single element, corresponding to the SSRC of the 49 // media stream being protected by this FlexFEC stream. The vector MUST have 50 // size 1. 51 // 52 // TODO(brandtr): Update comment above when we support multistream 53 // protection. 54 std::vector<uint32_t> protected_media_ssrcs; 55 56 // What RTCP mode to use in the reports. 57 RtcpMode rtcp_mode = RtcpMode::kCompound; 58 59 // Transport for outgoing RTCP packets. 60 Transport* rtcp_send_transport = nullptr; 61 }; 62 63 // TODO(tommi): FlexfecReceiveStream inherits from ReceiveStreamInterface, 64 // not VideoReceiveStreamInterface where there's also a SetRtcpMode method. 65 // Perhaps this should be in ReceiveStreamInterface and apply to audio streams 66 // as well (although there's no logic that would use it at present). 67 virtual void SetRtcpMode(RtcpMode mode) = 0; 68 69 // Called to change the payload type after initialization. 70 virtual void SetPayloadType(int payload_type) = 0; 71 virtual int payload_type() const = 0; 72 }; 73 74 } // namespace webrtc 75 76 #endif // CALL_FLEXFEC_RECEIVE_STREAM_H_ 77