niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
andrew@webrtc.org | 7fe219f | 2012-02-01 02:40:37 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_ |
| 12 | #define MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Rasmus Brandt | 78db158 | 2016-09-21 09:19:34 +0200 | [diff] [blame] | 14 | #include <memory> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 17 | #include "modules/rtp_rtcp/include/ulpfec_receiver.h" |
| 18 | #include "modules/rtp_rtcp/source/forward_error_correction.h" |
| 19 | #include "rtc_base/criticalsection.h" |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 20 | #include "typedefs.h" // NOLINT(build/include) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 23 | |
brandtr | d55c3f6 | 2016-10-31 04:51:33 -0700 | [diff] [blame] | 24 | class UlpfecReceiverImpl : public UlpfecReceiver { |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 25 | public: |
brandtr | d726a3f | 2017-06-29 02:45:35 -0700 | [diff] [blame] | 26 | explicit UlpfecReceiverImpl(uint32_t ssrc, RecoveredPacketReceiver* callback); |
brandtr | d55c3f6 | 2016-10-31 04:51:33 -0700 | [diff] [blame] | 27 | virtual ~UlpfecReceiverImpl(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 29 | int32_t AddReceivedRedPacket(const RTPHeader& rtp_header, |
| 30 | const uint8_t* incoming_rtp_packet, |
| 31 | size_t packet_length, |
| 32 | uint8_t ulpfec_payload_type) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 34 | int32_t ProcessReceivedFec() override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 36 | FecPacketCounter GetPacketCounter() const override; |
asapersson@webrtc.org | 0800db7 | 2015-01-15 07:40:20 +0000 | [diff] [blame] | 37 | |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 38 | private: |
brandtr | d726a3f | 2017-06-29 02:45:35 -0700 | [diff] [blame] | 39 | const uint32_t ssrc_; |
| 40 | |
danilchap | 7c9426c | 2016-04-14 03:05:31 -0700 | [diff] [blame] | 41 | rtc::CriticalSection crit_sect_; |
nisse | 30e8931 | 2017-05-29 08:16:37 -0700 | [diff] [blame] | 42 | RecoveredPacketReceiver* recovered_packet_callback_; |
Rasmus Brandt | 78db158 | 2016-09-21 09:19:34 +0200 | [diff] [blame] | 43 | std::unique_ptr<ForwardErrorCorrection> fec_; |
brandtr | 74811e5 | 2016-08-10 00:51:50 -0700 | [diff] [blame] | 44 | // TODO(holmer): In the current version |received_packets_| is never more |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 45 | // than one packet, since we process FEC every time a new packet |
| 46 | // arrives. We should remove the list. |
brandtr | 74811e5 | 2016-08-10 00:51:50 -0700 | [diff] [blame] | 47 | ForwardErrorCorrection::ReceivedPacketList received_packets_; |
| 48 | ForwardErrorCorrection::RecoveredPacketList recovered_packets_; |
asapersson@webrtc.org | 0800db7 | 2015-01-15 07:40:20 +0000 | [diff] [blame] | 49 | FecPacketCounter packet_counter_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 50 | }; |
brandtr | a2ece73 | 2016-10-04 00:00:06 -0700 | [diff] [blame] | 51 | |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 52 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 54 | #endif // MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_ |