blob: 6d223efdfa3995bdc363ff8497b80a7f71278576 [file] [log] [blame]
Niels Möller70082872018-08-07 09:03:121/*
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 13:01:3913#include "absl/functional/any_invocable.h"
Steve Anton10542f22019-01-11 17:11:0014#include "api/media_types.h"
Per Kcf439a02023-01-05 13:01:3915#include "modules/rtp_rtcp/source/rtp_packet_received.h"
16#include "rtc_base/checks.h"
Steve Anton10542f22019-01-11 17:11:0017#include "rtc_base/copy_on_write_buffer.h"
Niels Möller70082872018-08-07 09:03:1218
19namespace webrtc {
20
21class PacketReceiver {
22 public:
Per Kcf439a02023-01-05 13:01:3923 // Demux RTCP packets. Must be called on the worker thread.
Per K664cf142023-01-25 14:19:1124 virtual void DeliverRtcpPacket(rtc::CopyOnWriteBuffer packet) = 0;
Per Kcf439a02023-01-05 13:01:3925
Per Kd4403582024-02-22 12:45:1626 // Invoked once when a packet is received that can not be demuxed.
Per Kcf439a02023-01-05 13:01:3927 // 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
Per Kf6ce1d32023-03-28 15:27:4731 // Must be called on the worker thread.
32 // If `media_type` is not Audio or Video, packets may be used for BWE
33 // calculations but are not demuxed.
Per Kcf439a02023-01-05 13:01:3934 virtual void DeliverRtpPacket(
35 MediaType media_type,
36 RtpPacketReceived packet,
Per K664cf142023-01-25 14:19:1137 OnUndemuxablePacketHandler undemuxable_packet_handler) = 0;
Per Kcf439a02023-01-05 13:01:3938
Niels Möller70082872018-08-07 09:03:1239 protected:
40 virtual ~PacketReceiver() {}
41};
42
43} // namespace webrtc
44
45#endif // CALL_PACKET_RECEIVER_H_