blob: e98055ae3bce5fb4205aeee00634fbab28b23b72 [file] [log] [blame]
nisseeed52bf2017-05-19 13:15:191/*
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 04:47:3111#ifndef CALL_RTX_RECEIVE_STREAM_H_
12#define CALL_RTX_RECEIVE_STREAM_H_
nisseeed52bf2017-05-19 13:15:1913
Stephan Hartmann03fade52020-05-02 12:17:0514#include <cstdint>
nisseeed52bf2017-05-19 13:15:1915#include <map>
16
Tommi13b9f812022-08-16 08:23:4717#include "api/sequence_checker.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3118#include "call/rtp_packet_sink_interface.h"
Tommi13b9f812022-08-16 08:23:4719#include "rtc_base/system/no_unique_address.h"
Harald Alvestrand93c9aa12024-09-02 20:55:5220#include "rtc_base/thread_annotations.h"
nisseeed52bf2017-05-19 13:15:1921
22namespace webrtc {
23
nisseca5706d2017-09-11 09:32:1624class ReceiveStatistics;
25
nisse38644992017-08-30 11:16:4026// This class is responsible for RTX decapsulation. The resulting media packets
27// are passed on to a sink representing the associated media stream.
nisseeed52bf2017-05-19 13:15:1928class RtxReceiveStream : public RtpPacketSinkInterface {
29 public:
30 RtxReceiveStream(RtpPacketSinkInterface* media_sink,
nisse38644992017-08-30 11:16:4031 std::map<int, int> associated_payload_types,
nisseca5706d2017-09-11 09:32:1632 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);
nisse76e62b02017-05-31 09:24:5238 ~RtxReceiveStream() override;
Tommi13b9f812022-08-16 08:23:4739
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
nisseeed52bf2017-05-19 13:15:1944 // RtpPacketSinkInterface.
45 void OnRtpPacket(const RtpPacketReceived& packet) override;
46
47 private:
Tommi13b9f812022-08-16 08:23:4748 RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_checker_;
nisseeed52bf2017-05-19 13:15:1949 RtpPacketSinkInterface* const media_sink_;
nisse38644992017-08-30 11:16:4050 // Map from rtx payload type -> media payload type.
Tommi13b9f812022-08-16 08:23:4751 std::map<int, int> associated_payload_types_ RTC_GUARDED_BY(&packet_checker_);
nisseeed52bf2017-05-19 13:15:1952 // 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_;
nisseca5706d2017-09-11 09:32:1655 ReceiveStatistics* const rtp_receive_statistics_;
nisseeed52bf2017-05-19 13:15:1956};
57
58} // namespace webrtc
59
Mirko Bonadei92ea95e2017-09-15 04:47:3160#endif // CALL_RTX_RECEIVE_STREAM_H_