Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: webrtc/call/rtp_transport_controller_receive.h

Issue 2709723003: Initial implementation of RtpTransportControllerReceive and related interfaces.
Patch Set: Adapt Call to use the new RtpTransportReceive class. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // TODO(nisse): This additional interface may be a bit confusing, it's
danilchap 2017/03/16 11:25:18 there are use cases (mid & rid) where extensions h
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 bool OnRtpPacketReceive(RtpPacketReceived* packet) = 0;
Taylor Brandstetter 2017/03/17 19:45:22 OnRtpPacketReceived instead of OnRtpPacketReceive?
50 virtual ~RtpPacketReceiverInterface() {}
51 };
52
53 class RtpPacketObserverInterface;
danilchap 2017/03/16 11:25:18 May be more concrete examples of receivers and obs
54
55 // This class represents the RTP receive parsing and demuxing. It isn't thread
56 // aware, leaving responsibility of multithreading issues to the user
57 // of this class.
58 // TODO(nisse): Add RTCP processing, we should aim to terminate RTCP
59 // and not leave any RTCP processing to individual receive streams.
60 // TODO(nisse): Extract parsing and demuxing logic into separate
61 // classes. A demuxer should handle only a single transport.
62 class RtpTransportControllerReceiveInterface {
63 public:
64 // Configuration needed for media-independent processing of received
65 // packets, in particular, feeding information to the congestion
66 // controller.
67
68 // TODO(nisse): It turns out this data is only used for the
69 // RtpPacketObserverInterface callback. Since we have no interest in
70 // the details, make it a void* pointer or use a template parameter
71 // for the type?
72 struct Config {
73 // See draft-holmer-rmcat-transport-wide-cc-extensions for details.
74 bool use_send_side_bwe = false;
75 };
76
77 // The Add* functions return true if registration succeeds, false if
78 // the ssrc is already taken, and the Remove* functions return true
79 // if the stream was found and removed, and false if the stream is
80 // unknown.
81
82 // Registers the receiver responsible for an ssrc. The |media_type|
83 // identifies the incoming transport, since we may use separate
84 // transport for audio and video, with independent ssrc spaces.
85 virtual bool AddReceiver(uint32_t ssrc,
86 MediaType media_type,
87 const Config& config,
88 RtpPacketReceiverInterface* receiver) = 0;
89 // TODO(nisse): It's unclear what info is conveniently available at
90 // remove time. For now, we take only the |receiver| pointer and
91 // iterate over the mapping.
92 virtual bool RemoveReceiver(const RtpPacketReceiverInterface* receiver) = 0;
93
94 // Used to represent auxillary sinks, currently used for FlexFec.
95 // The responsible receiver must be registered first.
96 virtual bool AddSink(uint32_t ssrc,
97 MediaType media_type,
98 RtpPacketSinkInterface* sink) = 0;
99 // TODO(nisse): It's unclear what info is conveniently available at
100 // remove time. For now, we take only the |receiver| pointer and
101 // iterate over the mapping.
102 virtual bool RemoveSink(const RtpPacketSinkInterface* sink) = 0;
103
104 #if 0
105 // TODO(nisse): Not yet implemented. We also need something similar to
106 // handle the mid extension.
107 // Incoming packets with unknown ssrcs represent unsignalled
108 // streams. We dispatch on payload type and media type. The receiver
109 // will typically create a new RtpReceiver to pass the packet to. A
110 // true return value from the callback means that we should retry
111 // lookup.
112 virtual bool AddPayload(uint8_t payload_type, MediaType media_type,
113 RtpPacketReceiverInterface *receiver) = 0;
114 #endif
115 // Process raw incoming RTP packets.
116 // TODO(nisse): DeliveryStatus is needed for the current handling of
117 // unsignalled ssrcs. Change return type to bool or void, once we do
118 // that via AddPayload instead.
119 virtual PacketReceiver::DeliveryStatus OnRtpPacket(
120 MediaType media_type,
121 int64_t arrival_time_ms,
122 rtc::ArrayView<const uint8_t> packet) = 0;
123
124 virtual ~RtpTransportControllerReceiveInterface() {}
125
126 // Creates the default implementation.
Taylor Brandstetter 2017/03/17 19:45:22 Add comment for what |observer| is meant for?
127 static std::unique_ptr<RtpTransportControllerReceiveInterface> Create(
128 RtpPacketObserverInterface* observer);
129 };
130
131 // Callback invoked for all processed RTP packets, used for feeding
132 // the congestion controller (which is more tightly coupled to the
133 // send side).
134 class RtpPacketObserverInterface {
Taylor Brandstetter 2017/03/17 19:45:22 The distinction between "RtpPacketObserver", "RtpP
135 public:
136 virtual void OnRtpPacket(
137 // TODO(nisse): Add media type / transport id to the RtpParsedPacket.
138 MediaType media_type,
139 const RtpTransportControllerReceiveInterface::Config config,
140 const RtpPacketReceived& packet) = 0;
141 virtual ~RtpPacketObserverInterface() {}
142 };
143
144 } // namespace webrtc
145
146 #endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_
OLDNEW
« no previous file with comments | « webrtc/call/flexfec_receive_stream_impl.cc ('k') | webrtc/call/rtp_transport_controller_receive.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698