blob: c7f55ac46c0ee1ca849ab95abc44fe59e90a35e9 [file] [log] [blame]
Niels Möller70082872018-08-07 11:03:12 +02001/*
2 * Copyright (c) 2018 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#ifndef CALL_PACKET_RECEIVER_H_
11#define CALL_PACKET_RECEIVER_H_
12
Per Kcf439a02023-01-05 14:01:39 +010013#include "absl/functional/any_invocable.h"
Steve Anton10542f22019-01-11 09:11:00 -080014#include "api/media_types.h"
Per Kcf439a02023-01-05 14:01:39 +010015#include "modules/rtp_rtcp/source/rtp_packet_received.h"
16#include "rtc_base/checks.h"
Steve Anton10542f22019-01-11 09:11:00 -080017#include "rtc_base/copy_on_write_buffer.h"
Niels Möller70082872018-08-07 11:03:12 +020018
19namespace webrtc {
20
21class PacketReceiver {
22 public:
Per Kcf439a02023-01-05 14:01:39 +010023 // Demux RTCP packets. Must be called on the worker thread.
Per K664cf142023-01-25 15:19:11 +010024 virtual void DeliverRtcpPacket(rtc::CopyOnWriteBuffer packet) = 0;
Per Kcf439a02023-01-05 14:01:39 +010025
26 // Invoked once when a packet packet is received that can not be demuxed.
27 // If the method returns true, a new attempt is made to demux the packet.
28 using OnUndemuxablePacketHandler =
29 absl::AnyInvocable<bool(const RtpPacketReceived& parsed_packet)>;
30
31 // Demux RTP packets. Must be called on the worker thread.
32 virtual void DeliverRtpPacket(
33 MediaType media_type,
34 RtpPacketReceived packet,
Per K664cf142023-01-25 15:19:11 +010035 OnUndemuxablePacketHandler undemuxable_packet_handler) = 0;
Per Kcf439a02023-01-05 14:01:39 +010036
Niels Möller70082872018-08-07 11:03:12 +020037 protected:
38 virtual ~PacketReceiver() {}
39};
40
41} // namespace webrtc
42
43#endif // CALL_PACKET_RECEIVER_H_