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 "webrtc/base/array_view.h" | |
14 | |
15 // For MediaType and DeliveryStatus. | |
16 // TODO(nisse): This file ought to not depend on call. We could move | |
17 // MediaType definition here, and perhaps rename it to transport_id in | |
18 // the process, since its main purpose is to disambiguate ssrc | |
19 // collisions between transports. | |
20 #include "webrtc/call/call.h" | |
21 | |
22 namespace webrtc { | |
23 | |
24 class RtpPacketReceived; | |
25 | |
26 // This class represents a receiver of already parsed RTP packets. | |
27 class RtpPacketSinkInterface { | |
28 public: | |
29 virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0; | |
30 virtual ~RtpPacketSinkInterface() {} | |
31 }; | |
32 | |
33 // This class represents a receiver of RTP packets, which has the | |
34 // additional responsibility of identifying extension headers. I.e., | |
35 // the caller of OnRtpPacketReceive is expected to have called | |
36 // packet->Parse, but not packet->IdentifyExtensions. | |
37 class RtpPacketReceiverInterface { | |
38 public: | |
39 virtual bool OnRtpPacketReceive(RtpPacketReceived* packet) = 0; | |
40 virtual ~RtpPacketReceiverInterface() {} | |
41 }; | |
pthatcher1
2017/02/23 00:26:09
I find the distinction between these two sinks con
| |
42 | |
43 class RtpPacketObserverInterface; | |
44 | |
45 // This class represents the RTP receive demuxing. It isn't thread | |
46 // aware, leaving responsibility of multithreading issues to the user | |
47 // of this class. | |
48 // TODO(nisse): Add RTCP processing, we should aim to terminate RTCP | |
49 // and not leave any RTCP processing to individual receive streams. | |
50 class RtpTransportControllerReceiveInterface { | |
pthatcher1
2017/02/23 00:26:09
Why not just call it RtpDemuxerInterface?
| |
51 public: | |
52 // Configuration needed for media-independent processing of received | |
53 // packets, in particular, feeding information to the congestion | |
54 // controller. | |
55 | |
56 // TODO(nisse): It turns out this data is only used for the | |
57 // RtpPacketObserverInterface callback. Since we have no interest in | |
58 // the details, make it a void* pointer or use a template parameter | |
59 // for the type? | |
60 struct Config { | |
61 // See draft-holmer-rmcat-transport-wide-cc-extensions for details. | |
62 bool use_send_side_bwe = false; | |
63 }; | |
64 | |
65 // The Register* functions return true if registration succeeds, | |
66 // false if the ssrc is already taken. | |
67 | |
68 // Registers the receiver responsible for an ssrc. The |media_type| | |
69 // identifies the incoming transport, since we may use separate | |
70 // transport for audio and video, with independent ssrc spaces. | |
pthatcher1
2017/02/23 00:26:09
I think it would be a mistake to have an RtpDemuxe
| |
71 virtual bool AddReceiver(uint32_t ssrc, | |
72 MediaType media_type, | |
73 const Config& config, | |
74 RtpPacketReceiverInterface* receiver) = 0; | |
75 // TODO(nisse): It's unclear what info is conveniently available at | |
76 // remove time. For now, we take only the |receiver| pointer and | |
77 // iterate over the mapping. | |
pthatcher1
2017/02/23 00:26:09
The name here should match that for PayloadType be
| |
78 virtual bool RemoveReceiver(const RtpPacketReceiverInterface* receiver); | |
79 | |
80 // Used to represent auxillary sinks, currently used for FlexFec. | |
81 // The responsible receiver must be registered first. | |
82 virtual bool AddSink(uint32_t ssrc, | |
83 MediaType media_type, | |
84 RtpPacketSinkInterface* sink) = 0; | |
85 // TODO(nisse): It's unclear what info is conveniently available at | |
86 // remove time. For now, we take only the |receiver| pointer and | |
87 // iterate over the mapping. | |
88 virtual bool RemoveSink(const RtpPacketSinkInterface* sink); | |
89 | |
90 #if 0 | |
91 // TODO(nisse): Not yet implemented. | |
92 // Incoming packets with unknown ssrcs represent unsignalled | |
93 // streams. We dispatch on payload type and media type. The receiver | |
94 // will typically create a new RtpReceiver to pass the packet to. A | |
95 // true return value from the callback means that we should retry | |
96 // lookup. | |
97 virtual bool AddPayload(uint8_t payload_type, MediaType media_type, | |
98 RtpPacketReceiverInterface *receiver) = 0; | |
pthatcher1
2017/02/23 00:26:09
The name here should match the AddReceiver (or Add
| |
99 #endif | |
100 // Process raw incoming RTP packets. | |
101 // TODO(nisse): DeliveryStatus is needed for the current handling of | |
102 // unsignalled ssrcs. Change return type to bool or void, once we do | |
103 // that via AddPayload instead. | |
104 virtual PacketReceiver::DeliveryStatus OnRtpPacket( | |
105 MediaType media_type, | |
pthatcher1
2017/02/23 00:26:09
How do you know the media type of an unparsed, und
| |
106 rtc::ArrayView<const uint8_t> packet) = 0; | |
pthatcher1
2017/02/23 00:26:09
Yes another RtpPacket sink!
What is this one? An
| |
107 | |
108 virtual ~RtpTransportControllerReceiveInterface(); | |
109 | |
110 // Creates the default implementation. | |
111 static RtpTransportControllerReceiveInterface* Create( | |
112 RtpPacketObserverInterface* observer); | |
113 }; | |
114 | |
115 // Callback invoked for all processed RTP packets, used for feeding | |
116 // the congestion controller (which is more tightly coupled to the | |
117 // send side). | |
pthatcher1
2017/02/23 00:26:09
Yet another sink! One is called a sink, one's c
| |
118 class RtpPacketObserverInterface { | |
119 public: | |
120 virtual void OnRtpPacket( | |
121 // TODO(nisse): Add media type / transport id to the RtpParsedPacket. | |
122 MediaType media_type, | |
123 const RtpTransportControllerReceiveInterface::Config, | |
124 const RtpPacketReceived& packet) = 0; | |
125 virtual ~RtpPacketObserverInterface(); | |
126 }; | |
127 | |
128 } // namespace webrtc | |
129 | |
130 #endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ | |
OLD | NEW |