OLD | NEW |
---|---|
(Empty) | |
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 #ifndef WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ | |
11 #define WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ | |
12 | |
13 #include <memory> | |
14 | |
15 #include "webrtc/base/array_view.h" | |
16 | |
17 // For DeliveryStatus. | |
18 // TODO(nisse): This file ought to not depend on call. | |
19 #include "webrtc/call/call.h" | |
20 | |
21 namespace webrtc { | |
22 | |
23 class ReceiveSideCongestionController; | |
24 class RtpPacketReceived; | |
25 | |
26 // This class represents a receiver of already parsed RTP packets. | |
27 class RtpPacketSinkInterface { | |
28 public: | |
29 virtual ~RtpPacketSinkInterface() {} | |
30 virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0; | |
31 }; | |
32 | |
33 // TODO(nisse): This additional interface may be a bit confusing, it's | |
34 // needed because RTP extensions are currently associated with each | |
35 // stream. We should be able to identify extensions earlier, since the | |
36 // mapping is the same for all streams on the same transport. Then we | |
37 // can delete this class, replacing it with RtpPacketSinkInterface. | |
38 // There's also the subtlety that the per-transport negotiation may | |
39 // differ from the extensions expected for a particular stream, and we | |
40 // may have code that breaks if we identify extension which is not | |
41 // consistent with the configuration of the stream. | |
42 | |
43 // This class represents a receiver of RTP packets, which has the | |
44 // additional responsibility of identifying extension headers. I.e., | |
45 // the caller of OnRtpPacketReceive is expected to have called | |
46 // packet->Parse, but not packet->IdentifyExtensions. | |
47 class RtpPacketReceiverInterface { | |
48 public: | |
49 virtual ~RtpPacketReceiverInterface() {} | |
50 virtual bool OnRtpPacketReceive(RtpPacketReceived* packet) = 0; | |
51 }; | |
52 | |
53 // This class represents the RTP receive parsing and demuxing, for a | |
54 // single transport. It isn't thread aware, leaving responsibility of | |
55 // multithreading issues to the user of this class. TODO(nisse): Add | |
56 // RTCP processing, we should aim to terminate RTCP and not leave any | |
57 // RTCP processing to individual receive streams. TODO(nisse): Extract | |
58 // parsing and demuxing logic into separate classes. A demuxer should | |
59 // handle only a single transport. | |
60 class RtpTransportControllerReceiveInterface { | |
61 public: | |
62 // Configuration needed for media-independent processing of received | |
63 // packets, in particular, feeding information to the congestion | |
64 // controller. | |
65 | |
66 // TODO(nisse): It turns out this data is only used for the callback | |
danilchap
2017/04/25 09:33:40
what (and when) should be done about it?
nisse-webrtc
2017/04/25 11:22:50
I'm rephrasing the comment. There's nothing obviou
| |
67 // to the ReceiveSideCongestionController. | |
68 struct Config { | |
69 // See draft-holmer-rmcat-transport-wide-cc-extensions for details. | |
70 bool use_send_side_bwe = false; | |
danilchap
2017/04/25 09:33:40
why controller itself configured with 'enable_rece
nisse-webrtc
2017/04/25 11:22:50
|enable_receive_side_bwe| used to be a check of th
| |
71 }; | |
72 | |
73 // Creates the default implementation. | |
74 static std::unique_ptr<RtpTransportControllerReceiveInterface> Create( | |
75 ReceiveSideCongestionController* receive_side_cc, | |
76 bool enable_receive_side_bwe); | |
77 | |
78 virtual ~RtpTransportControllerReceiveInterface() {} | |
79 | |
80 // Registers the receiver responsible for an ssrc. | |
81 virtual void AddReceiver(uint32_t ssrc, | |
82 const Config& config, | |
83 RtpPacketReceiverInterface* receiver) = 0; | |
84 // TODO(nisse): It's unclear what info is conveniently available at | |
85 // remove time. For now, we take only the |receiver| pointer and | |
86 // iterate over the mapping. | |
87 virtual void RemoveReceiver(const RtpPacketReceiverInterface* receiver) = 0; | |
88 | |
89 // Used to represent auxillary sinks, currently used for FlexFec. | |
90 // The responsible receiver must be registered first. | |
91 virtual void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink) = 0; | |
92 // TODO(nisse): It's unclear what info is conveniently available at | |
93 // remove time. For now, we take only the |receiver| pointer and | |
94 // iterate over the mapping. | |
95 virtual void RemoveSink(const RtpPacketSinkInterface* sink) = 0; | |
96 | |
97 // Process raw incoming RTP packets. | |
98 // TODO(nisse): DeliveryStatus is needed for the current handling of | |
99 // unsignalled ssrcs. Change return type to bool or void, once we do | |
100 // that via AddPayload instead. | |
101 virtual PacketReceiver::DeliveryStatus OnRtpPacket( | |
102 int64_t arrival_time_ms, | |
103 rtc::ArrayView<const uint8_t> packet) = 0; | |
104 }; | |
105 | |
106 } // namespace webrtc | |
107 | |
108 #endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ | |
OLD | NEW |