blob: 79b03d306b0652b1f52a195c523a9c05165a4893 [file] [log] [blame]
nisseeed52bf2017-05-19 06:15:19 -07001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef CALL_RTX_RECEIVE_STREAM_H_
12#define CALL_RTX_RECEIVE_STREAM_H_
nisseeed52bf2017-05-19 06:15:19 -070013
Stephan Hartmann03fade52020-05-02 12:17:05 +000014#include <cstdint>
nisseeed52bf2017-05-19 06:15:19 -070015#include <map>
16
Tommi13b9f812022-08-16 10:23:47 +020017#include "api/sequence_checker.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "call/rtp_packet_sink_interface.h"
Tommi13b9f812022-08-16 10:23:47 +020019#include "rtc_base/system/no_unique_address.h"
nisseeed52bf2017-05-19 06:15:19 -070020
21namespace webrtc {
22
nisseca5706d2017-09-11 02:32:16 -070023class ReceiveStatistics;
24
nisse38644992017-08-30 04:16:40 -070025// This class is responsible for RTX decapsulation. The resulting media packets
26// are passed on to a sink representing the associated media stream.
nisseeed52bf2017-05-19 06:15:19 -070027class RtxReceiveStream : public RtpPacketSinkInterface {
28 public:
29 RtxReceiveStream(RtpPacketSinkInterface* media_sink,
nisse38644992017-08-30 04:16:40 -070030 std::map<int, int> associated_payload_types,
nisseca5706d2017-09-11 02:32:16 -070031 uint32_t media_ssrc,
32 // TODO(nisse): Delete this argument, and
33 // corresponding member variable, by moving the
34 // responsibility for rtcp feedback to
35 // RtpStreamReceiverController.
36 ReceiveStatistics* rtp_receive_statistics = nullptr);
nisse76e62b02017-05-31 02:24:52 -070037 ~RtxReceiveStream() override;
Tommi13b9f812022-08-16 10:23:47 +020038
39 // Update payload types post construction. Must be called from the same
40 // calling context as `OnRtpPacket` is called on.
41 void SetAssociatedPayloadTypes(std::map<int, int> associated_payload_types);
42
nisseeed52bf2017-05-19 06:15:19 -070043 // RtpPacketSinkInterface.
44 void OnRtpPacket(const RtpPacketReceived& packet) override;
45
46 private:
Tommi13b9f812022-08-16 10:23:47 +020047 RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_checker_;
nisseeed52bf2017-05-19 06:15:19 -070048 RtpPacketSinkInterface* const media_sink_;
nisse38644992017-08-30 04:16:40 -070049 // Map from rtx payload type -> media payload type.
Tommi13b9f812022-08-16 10:23:47 +020050 std::map<int, int> associated_payload_types_ RTC_GUARDED_BY(&packet_checker_);
nisseeed52bf2017-05-19 06:15:19 -070051 // TODO(nisse): Ultimately, the media receive stream shouldn't care about the
52 // ssrc, and we should delete this.
53 const uint32_t media_ssrc_;
nisseca5706d2017-09-11 02:32:16 -070054 ReceiveStatistics* const rtp_receive_statistics_;
nisseeed52bf2017-05-19 06:15:19 -070055};
56
57} // namespace webrtc
58
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020059#endif // CALL_RTX_RECEIVE_STREAM_H_