blob: f3894f5d7764170986a333d17e0d1d3520239b62 [file] [log] [blame]
brandtra8b38552016-10-10 16:44:57 -07001/*
2 * Copyright (c) 2016 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_FLEXFEC_RECEIVER_H_
12#define WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_
13
14#include <memory>
15
16#include "webrtc/base/basictypes.h"
17#include "webrtc/modules/rtp_rtcp/include/fec_receiver.h"
18
19namespace webrtc {
20
21// Callback interface for packets recovered by FlexFEC.
22class RecoveredPacketReceiver {
23 public:
24 virtual bool OnRecoveredPacket(const uint8_t* packet, size_t length) = 0;
25
26 protected:
27 virtual ~RecoveredPacketReceiver() = default;
28};
29
30class FlexfecReceiver {
31 public:
32 static std::unique_ptr<FlexfecReceiver> Create(
33 uint32_t flexfec_ssrc,
34 uint32_t protected_media_ssrc,
35 RecoveredPacketReceiver* callback);
36 virtual ~FlexfecReceiver();
37
38 // Inserts a received packet (can be either media or FlexFEC) into the
39 // internal buffer, and sends the received packets to the erasure code.
40 // All newly recovered packets are sent back through the callback.
41 virtual bool AddAndProcessReceivedPacket(const uint8_t* packet,
42 size_t packet_length) = 0;
43
44 // Returns a counter describing the added and recovered packets.
45 virtual FecPacketCounter GetPacketCounter() const = 0;
46};
47
48} // namespace webrtc
49
50#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FLEXFEC_RECEIVER_H_