| 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 |
| 13 | #include "absl/functional/any_invocable.h" |
| 14 | #include "api/media_types.h" |
| 15 | #include "modules/rtp_rtcp/source/rtp_packet_received.h" |
| 16 | #include "rtc_base/checks.h" |
| 17 | #include "rtc_base/copy_on_write_buffer.h" |
| 18 |
| 19 | namespace webrtc { |
| 20 |
| 21 | class PacketReceiver { |
| 22 | public: |
| 23 | // Demux RTCP packets. Must be called on the worker thread. |
| 24 | virtual void DeliverRtcpPacket(rtc::CopyOnWriteBuffer packet) = 0; |
| 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 | // 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. |
| 34 | virtual void DeliverRtpPacket( |
| 35 | MediaType media_type, |
| 36 | RtpPacketReceived packet, |
| 37 | OnUndemuxablePacketHandler undemuxable_packet_handler) = 0; |
| 38 |
| 39 | protected: |
| 40 | virtual ~PacketReceiver() {} |
| 41 | }; |
| 42 |
| 43 | } // namespace webrtc |
| 44 |
| 45 | #endif // CALL_PACKET_RECEIVER_H_ |
| 46 |