blob: 80257298bda9857b1a7c8ab13d5311b130e7af22 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.org7fe219f2012-02-01 02:40:37 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
12#define MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Rasmus Brandt78db1582016-09-21 09:19:34 +020014#include <memory>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#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 Bonadei71207422017-09-15 13:58:09 +020020#include "typedefs.h" // NOLINT(build/include)
niklase@google.com470e71d2011-07-07 08:21:25 +000021
22namespace webrtc {
wu@webrtc.org822fbd82013-08-15 23:38:54 +000023
brandtrd55c3f62016-10-31 04:51:33 -070024class UlpfecReceiverImpl : public UlpfecReceiver {
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000025 public:
brandtrd726a3f2017-06-29 02:45:35 -070026 explicit UlpfecReceiverImpl(uint32_t ssrc, RecoveredPacketReceiver* callback);
brandtrd55c3f62016-10-31 04:51:33 -070027 virtual ~UlpfecReceiverImpl();
niklase@google.com470e71d2011-07-07 08:21:25 +000028
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000029 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.com470e71d2011-07-07 08:21:25 +000033
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000034 int32_t ProcessReceivedFec() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000035
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000036 FecPacketCounter GetPacketCounter() const override;
asapersson@webrtc.org0800db72015-01-15 07:40:20 +000037
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000038 private:
brandtrd726a3f2017-06-29 02:45:35 -070039 const uint32_t ssrc_;
40
danilchap7c9426c2016-04-14 03:05:31 -070041 rtc::CriticalSection crit_sect_;
nisse30e89312017-05-29 08:16:37 -070042 RecoveredPacketReceiver* recovered_packet_callback_;
Rasmus Brandt78db1582016-09-21 09:19:34 +020043 std::unique_ptr<ForwardErrorCorrection> fec_;
brandtr74811e52016-08-10 00:51:50 -070044 // TODO(holmer): In the current version |received_packets_| is never more
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000045 // than one packet, since we process FEC every time a new packet
46 // arrives. We should remove the list.
brandtr74811e52016-08-10 00:51:50 -070047 ForwardErrorCorrection::ReceivedPacketList received_packets_;
48 ForwardErrorCorrection::RecoveredPacketList recovered_packets_;
asapersson@webrtc.org0800db72015-01-15 07:40:20 +000049 FecPacketCounter packet_counter_;
niklase@google.com470e71d2011-07-07 08:21:25 +000050};
brandtra2ece732016-10-04 00:00:06 -070051
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000052} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000053
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020054#endif // MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_