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 | |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 16 | |
Rasmus Brandt | 78db158 | 2016-09-21 09:19:34 +0200 | [diff] [blame] | 17 | #include <memory> |
nisse | a5f043f | 2017-09-18 07:58:59 -0700 | [diff] [blame] | 18 | #include <vector> |
Rasmus Brandt | 78db158 | 2016-09-21 09:19:34 +0200 | [diff] [blame] | 19 | |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 20 | #include "api/rtp_headers.h" |
Ilya Nikolaevskiy | 2d821c3 | 2019-06-26 14:39:36 +0200 | [diff] [blame] | 21 | #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 22 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 23 | #include "modules/rtp_rtcp/include/ulpfec_receiver.h" |
| 24 | #include "modules/rtp_rtcp/source/forward_error_correction.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 25 | #include "rtc_base/critical_section.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 26 | |
| 27 | namespace webrtc { |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 28 | |
brandtr | d55c3f6 | 2016-10-31 04:51:33 -0700 | [diff] [blame] | 29 | class UlpfecReceiverImpl : public UlpfecReceiver { |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 30 | public: |
Ilya Nikolaevskiy | 2d821c3 | 2019-06-26 14:39:36 +0200 | [diff] [blame] | 31 | explicit UlpfecReceiverImpl(uint32_t ssrc, |
| 32 | RecoveredPacketReceiver* callback, |
| 33 | rtc::ArrayView<const RtpExtension> extensions); |
Danil Chapovalov | 2a5ce2b | 2018-02-07 09:38:31 +0100 | [diff] [blame] | 34 | ~UlpfecReceiverImpl() 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 | int32_t AddReceivedRedPacket(const RTPHeader& rtp_header, |
| 37 | const uint8_t* incoming_rtp_packet, |
| 38 | size_t packet_length, |
| 39 | uint8_t ulpfec_payload_type) override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 41 | int32_t ProcessReceivedFec() override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 43 | FecPacketCounter GetPacketCounter() const override; |
asapersson@webrtc.org | 0800db7 | 2015-01-15 07:40:20 +0000 | [diff] [blame] | 44 | |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 45 | private: |
brandtr | d726a3f | 2017-06-29 02:45:35 -0700 | [diff] [blame] | 46 | const uint32_t ssrc_; |
Ilya Nikolaevskiy | 2d821c3 | 2019-06-26 14:39:36 +0200 | [diff] [blame] | 47 | const RtpHeaderExtensionMap extensions_; |
brandtr | d726a3f | 2017-06-29 02:45:35 -0700 | [diff] [blame] | 48 | |
danilchap | 7c9426c | 2016-04-14 03:05:31 -0700 | [diff] [blame] | 49 | rtc::CriticalSection crit_sect_; |
nisse | 30e8931 | 2017-05-29 08:16:37 -0700 | [diff] [blame] | 50 | RecoveredPacketReceiver* recovered_packet_callback_; |
Rasmus Brandt | 78db158 | 2016-09-21 09:19:34 +0200 | [diff] [blame] | 51 | std::unique_ptr<ForwardErrorCorrection> fec_; |
nisse | a5f043f | 2017-09-18 07:58:59 -0700 | [diff] [blame] | 52 | // TODO(nisse): The AddReceivedRedPacket method adds one or two packets to |
| 53 | // this list at a time, after which it is emptied by ProcessReceivedFec. It |
| 54 | // will make things simpler to merge AddReceivedRedPacket and |
| 55 | // ProcessReceivedFec into a single method, and we can then delete this list. |
| 56 | std::vector<std::unique_ptr<ForwardErrorCorrection::ReceivedPacket>> |
| 57 | received_packets_; |
brandtr | 74811e5 | 2016-08-10 00:51:50 -0700 | [diff] [blame] | 58 | ForwardErrorCorrection::RecoveredPacketList recovered_packets_; |
asapersson@webrtc.org | 0800db7 | 2015-01-15 07:40:20 +0000 | [diff] [blame] | 59 | FecPacketCounter packet_counter_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | }; |
brandtr | a2ece73 | 2016-10-04 00:00:06 -0700 | [diff] [blame] | 61 | |
phoglund@webrtc.org | 9919ad5 | 2013-05-16 15:06:28 +0000 | [diff] [blame] | 62 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 64 | #endif // MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_ |