Niels Möller | 7008287 | 2018-08-07 11:03:12 +0200 | [diff] [blame] | 1 | /* |
| 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 K | cf439a0 | 2023-01-05 14:01:39 +0100 | [diff] [blame] | 13 | #include "absl/functional/any_invocable.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 14 | #include "api/media_types.h" |
Per K | cf439a0 | 2023-01-05 14:01:39 +0100 | [diff] [blame] | 15 | #include "modules/rtp_rtcp/source/rtp_packet_received.h" |
| 16 | #include "rtc_base/checks.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 17 | #include "rtc_base/copy_on_write_buffer.h" |
Niels Möller | 7008287 | 2018-08-07 11:03:12 +0200 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | class PacketReceiver { |
| 22 | public: |
Per K | cf439a0 | 2023-01-05 14:01:39 +0100 | [diff] [blame] | 23 | // Demux RTCP packets. Must be called on the worker thread. |
Per K | 664cf14 | 2023-01-25 15:19:11 +0100 | [diff] [blame^] | 24 | virtual void DeliverRtcpPacket(rtc::CopyOnWriteBuffer packet) = 0; |
Per K | cf439a0 | 2023-01-05 14:01:39 +0100 | [diff] [blame] | 25 | |
| 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 K | 664cf14 | 2023-01-25 15:19:11 +0100 | [diff] [blame^] | 35 | OnUndemuxablePacketHandler undemuxable_packet_handler) = 0; |
Per K | cf439a0 | 2023-01-05 14:01:39 +0100 | [diff] [blame] | 36 | |
Niels Möller | 7008287 | 2018-08-07 11:03:12 +0200 | [diff] [blame] | 37 | protected: |
| 38 | virtual ~PacketReceiver() {} |
| 39 | }; |
| 40 | |
| 41 | } // namespace webrtc |
| 42 | |
| 43 | #endif // CALL_PACKET_RECEIVER_H_ |