nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef CALL_RTX_RECEIVE_STREAM_H_ |
| 12 | #define CALL_RTX_RECEIVE_STREAM_H_ |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 13 | |
Stephan Hartmann | 03fade5 | 2020-05-02 12:17:05 | [diff] [blame] | 14 | #include <cstdint> |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 15 | #include <map> |
| 16 | |
Tommi | 13b9f81 | 2022-08-16 08:23:47 | [diff] [blame] | 17 | #include "api/sequence_checker.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 18 | #include "call/rtp_packet_sink_interface.h" |
Tommi | 13b9f81 | 2022-08-16 08:23:47 | [diff] [blame] | 19 | #include "rtc_base/system/no_unique_address.h" |
Harald Alvestrand | 93c9aa1 | 2024-09-02 20:55:52 | [diff] [blame] | 20 | #include "rtc_base/thread_annotations.h" |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
nisse | ca5706d | 2017-09-11 09:32:16 | [diff] [blame] | 24 | class ReceiveStatistics; |
| 25 | |
nisse | 3864499 | 2017-08-30 11:16:40 | [diff] [blame] | 26 | // This class is responsible for RTX decapsulation. The resulting media packets |
| 27 | // are passed on to a sink representing the associated media stream. |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 28 | class RtxReceiveStream : public RtpPacketSinkInterface { |
| 29 | public: |
| 30 | RtxReceiveStream(RtpPacketSinkInterface* media_sink, |
nisse | 3864499 | 2017-08-30 11:16:40 | [diff] [blame] | 31 | std::map<int, int> associated_payload_types, |
nisse | ca5706d | 2017-09-11 09:32:16 | [diff] [blame] | 32 | uint32_t media_ssrc, |
| 33 | // TODO(nisse): Delete this argument, and |
| 34 | // corresponding member variable, by moving the |
| 35 | // responsibility for rtcp feedback to |
| 36 | // RtpStreamReceiverController. |
| 37 | ReceiveStatistics* rtp_receive_statistics = nullptr); |
nisse | 76e62b0 | 2017-05-31 09:24:52 | [diff] [blame] | 38 | ~RtxReceiveStream() override; |
Tommi | 13b9f81 | 2022-08-16 08:23:47 | [diff] [blame] | 39 | |
| 40 | // Update payload types post construction. Must be called from the same |
| 41 | // calling context as `OnRtpPacket` is called on. |
| 42 | void SetAssociatedPayloadTypes(std::map<int, int> associated_payload_types); |
| 43 | |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 44 | // RtpPacketSinkInterface. |
| 45 | void OnRtpPacket(const RtpPacketReceived& packet) override; |
| 46 | |
| 47 | private: |
Tommi | 13b9f81 | 2022-08-16 08:23:47 | [diff] [blame] | 48 | RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_checker_; |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 49 | RtpPacketSinkInterface* const media_sink_; |
nisse | 3864499 | 2017-08-30 11:16:40 | [diff] [blame] | 50 | // Map from rtx payload type -> media payload type. |
Tommi | 13b9f81 | 2022-08-16 08:23:47 | [diff] [blame] | 51 | std::map<int, int> associated_payload_types_ RTC_GUARDED_BY(&packet_checker_); |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 52 | // TODO(nisse): Ultimately, the media receive stream shouldn't care about the |
| 53 | // ssrc, and we should delete this. |
| 54 | const uint32_t media_ssrc_; |
nisse | ca5706d | 2017-09-11 09:32:16 | [diff] [blame] | 55 | ReceiveStatistics* const rtp_receive_statistics_; |
nisse | eed52bf | 2017-05-19 13:15:19 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace webrtc |
| 59 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 60 | #endif // CALL_RTX_RECEIVE_STREAM_H_ |