Line data Source code
1 : /*
2 : * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
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 :
11 : #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_ULPFEC_RECEIVER_H_
12 : #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_ULPFEC_RECEIVER_H_
13 :
14 : #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
15 : #include "webrtc/typedefs.h"
16 :
17 : namespace webrtc {
18 :
19 : struct FecPacketCounter {
20 0 : FecPacketCounter()
21 0 : : num_packets(0),
22 : num_fec_packets(0),
23 : num_recovered_packets(0),
24 0 : first_packet_time_ms(-1) {}
25 :
26 : size_t num_packets; // Number of received packets.
27 : size_t num_fec_packets; // Number of received FEC packets.
28 : size_t num_recovered_packets; // Number of recovered media packets using FEC.
29 : int64_t first_packet_time_ms; // Time when first packet is received.
30 : };
31 :
32 0 : class UlpfecReceiver {
33 : public:
34 : static UlpfecReceiver* Create(RtpData* callback);
35 :
36 0 : virtual ~UlpfecReceiver() {}
37 :
38 : // Takes a RED packet, strips the RED header, and adds the resulting
39 : // "virtual" RTP packet(s) into the internal buffer.
40 : //
41 : // TODO(brandtr): Set |ulpfec_payload_type| during constructor call,
42 : // rather than as a parameter here.
43 : virtual int32_t AddReceivedRedPacket(const RTPHeader& rtp_header,
44 : const uint8_t* incoming_rtp_packet,
45 : size_t packet_length,
46 : uint8_t ulpfec_payload_type) = 0;
47 :
48 : // Sends the received packets to the FEC and returns all packets
49 : // (both original media and recovered) through the callback.
50 : virtual int32_t ProcessReceivedFec() = 0;
51 :
52 : // Returns a counter describing the added and recovered packets.
53 : virtual FecPacketCounter GetPacketCounter() const = 0;
54 : };
55 : } // namespace webrtc
56 : #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_ULPFEC_RECEIVER_H_
|