blob: 2a1397535fab575606faf7dea054a31dda1a6768 [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"
18#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20namespace webrtc {
tnakamura@webrtc.orgaa4d96a2013-07-16 19:25:04 +000021class RTPReceiverVideo;
niklase@google.com470e71d2011-07-07 08:21:25 +000022
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000023class ReceiverFEC {
24 public:
tnakamura@webrtc.orgaa4d96a2013-07-16 19:25:04 +000025 ReceiverFEC(const int32_t id, RTPReceiverVideo* owner);
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000026 virtual ~ReceiverFEC();
niklase@google.com470e71d2011-07-07 08:21:25 +000027
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000028 int32_t AddReceivedFECPacket(const WebRtcRTPHeader* rtp_header,
29 const uint8_t* incoming_rtp_packet,
30 const uint16_t payload_data_length,
31 bool& FECpacket);
niklase@google.com470e71d2011-07-07 08:21:25 +000032
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000033 int32_t ProcessReceivedFEC();
niklase@google.com470e71d2011-07-07 08:21:25 +000034
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000035 void SetPayloadTypeFEC(const int8_t payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +000036
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000037 private:
tnakamura@webrtc.orgaa4d96a2013-07-16 19:25:04 +000038 int ParseAndReceivePacket(const ForwardErrorCorrection::Packet* packet);
39
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000040 int id_;
tnakamura@webrtc.orgaa4d96a2013-07-16 19:25:04 +000041 RTPReceiverVideo* owner_;
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000042 ForwardErrorCorrection* fec_;
43 // TODO(holmer): In the current version received_packet_list_ is never more
44 // than one packet, since we process FEC every time a new packet
45 // arrives. We should remove the list.
46 ForwardErrorCorrection::ReceivedPacketList received_packet_list_;
47 ForwardErrorCorrection::RecoveredPacketList recovered_packet_list_;
48 int8_t payload_type_fec_;
niklase@google.com470e71d2011-07-07 08:21:25 +000049};
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000050} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000051
phoglund@webrtc.org9919ad52013-05-16 15:06:28 +000052#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVER_FEC_H_