blob: 653a93e2fcbf3ae4db62cbd72eaa7e8d578e4180 [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
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVER_FEC_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVER_FEC_H_
13
marpan@webrtc.org57353a32011-12-16 17:21:09 +000014// This header is included to get the nested declaration of Packet structure.
niklase@google.com470e71d2011-07-07 08:21:25 +000015
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000016#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
17#include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
stefan@webrtc.org66b2e5c2013-07-05 14:30:48 +000018#include "webrtc/system_wrappers/interface/scoped_ptr.h"
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000019#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000020
21namespace webrtc {
stefan@webrtc.org66b2e5c2013-07-05 14:30:48 +000022
23class CriticalSectionWrapper;
niklase@google.com470e71d2011-07-07 08:21:25 +000024
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000025class ReceiverFEC {
26 public:
stefan@webrtc.org66b2e5c2013-07-05 14:30:48 +000027 ReceiverFEC(const int32_t id, RtpData* callback);
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000028 virtual ~ReceiverFEC();
niklase@google.com470e71d2011-07-07 08:21:25 +000029
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000030 int32_t AddReceivedFECPacket(const WebRtcRTPHeader* rtp_header,
31 const uint8_t* incoming_rtp_packet,
32 const uint16_t payload_data_length,
33 bool& FECpacket);
niklase@google.com470e71d2011-07-07 08:21:25 +000034
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000035 int32_t ProcessReceivedFEC();
niklase@google.com470e71d2011-07-07 08:21:25 +000036
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000037 void SetPayloadTypeFEC(const int8_t payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +000038
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000039 private:
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000040 int id_;
stefan@webrtc.org66b2e5c2013-07-05 14:30:48 +000041 scoped_ptr<CriticalSectionWrapper> crit_sect_;
42 RtpData* recovered_packet_callback_;
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000043 ForwardErrorCorrection* fec_;
44 // TODO(holmer): In the current version received_packet_list_ is never more
45 // than one packet, since we process FEC every time a new packet
46 // arrives. We should remove the list.
47 ForwardErrorCorrection::ReceivedPacketList received_packet_list_;
48 ForwardErrorCorrection::RecoveredPacketList recovered_packet_list_;
49 int8_t payload_type_fec_;
niklase@google.com470e71d2011-07-07 08:21:25 +000050};
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000051} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000052
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000053#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVER_FEC_H_