• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 #ifndef CALL_RTX_RECEIVE_STREAM_H_
12 #define CALL_RTX_RECEIVE_STREAM_H_
13 
14 #include <cstdint>
15 #include <map>
16 
17 #include "api/sequence_checker.h"
18 #include "call/rtp_packet_sink_interface.h"
19 #include "rtc_base/system/no_unique_address.h"
20 
21 namespace webrtc {
22 
23 class ReceiveStatistics;
24 
25 // This class is responsible for RTX decapsulation. The resulting media packets
26 // are passed on to a sink representing the associated media stream.
27 class RtxReceiveStream : public RtpPacketSinkInterface {
28  public:
29   RtxReceiveStream(RtpPacketSinkInterface* media_sink,
30                    std::map<int, int> associated_payload_types,
31                    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);
37   ~RtxReceiveStream() override;
38 
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 
43   // RtpPacketSinkInterface.
44   void OnRtpPacket(const RtpPacketReceived& packet) override;
45 
46  private:
47   RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_checker_;
48   RtpPacketSinkInterface* const media_sink_;
49   // Map from rtx payload type -> media payload type.
50   std::map<int, int> associated_payload_types_ RTC_GUARDED_BY(&packet_checker_);
51   // 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_;
54   ReceiveStatistics* const rtp_receive_statistics_;
55 };
56 
57 }  // namespace webrtc
58 
59 #endif  // CALL_RTX_RECEIVE_STREAM_H_
60