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

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

Issue 2709723003: Initial implementation of RtpTransportControllerReceive and related interfaces.
Patch Set: Fix audio. Created 3 years, 8 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 <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.
the sun 2017/04/18 09:59:00 It would be nice to use the type system to documen
nisse-webrtc 2017/04/19 08:35:43 I think I replied to this earlier... I use const f
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
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;
50 virtual ~RtpPacketReceiverInterface() {}
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
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;
71 };
72
73 // The Add* functions return true if registration succeeds, false if
74 // the ssrc is already taken, and the Remove* functions return true
75 // if the stream was found and removed, and false if the stream is
76 // unknown.
77
78 // Registers the receiver responsible for an ssrc.
79 virtual bool AddReceiver(uint32_t ssrc,
80 const Config& config,
81 RtpPacketReceiverInterface* receiver) = 0;
82 // TODO(nisse): It's unclear what info is conveniently available at
83 // remove time. For now, we take only the |receiver| pointer and
84 // iterate over the mapping.
85 virtual bool RemoveReceiver(const RtpPacketReceiverInterface* receiver) = 0;
86
87 // Used to represent auxillary sinks, currently used for FlexFec.
the sun 2017/04/18 09:59:00 I get the feeling that what you're implementing he
nisse-webrtc 2017/04/19 08:35:43 Probably. We just need to move complete parsing fu
88 // The responsible receiver must be registered first.
89 virtual bool AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink) = 0;
90 // TODO(nisse): It's unclear what info is conveniently available at
91 // remove time. For now, we take only the |receiver| pointer and
92 // iterate over the mapping.
93 virtual bool RemoveSink(const RtpPacketSinkInterface* sink) = 0;
94
95 #if 0
96 // TODO(nisse): Not yet implemented. We also need something similar to
97 // handle the mid extension.
98 // Incoming packets with unknown ssrcs represent unsignalled
99 // streams. We dispatch on payload type and media type. The receiver
100 // will typically create a new RtpReceiver to pass the packet to. A
101 // true return value from the callback means that we should retry
102 // lookup.
103 virtual bool AddPayload(uint8_t payload_type,
104 RtpPacketReceiverInterface *receiver) = 0;
105 #endif
106 // Process raw incoming RTP packets.
107 // TODO(nisse): DeliveryStatus is needed for the current handling of
108 // unsignalled ssrcs. Change return type to bool or void, once we do
109 // that via AddPayload instead.
110 virtual PacketReceiver::DeliveryStatus OnRtpPacket(
111 int64_t arrival_time_ms,
112 rtc::ArrayView<const uint8_t> packet) = 0;
113
114 virtual ~RtpTransportControllerReceiveInterface() {}
115
116 // Creates the default implementation.
117 static std::unique_ptr<RtpTransportControllerReceiveInterface> Create(
118 ReceiveSideCongestionController* receive_side_cc,
119 bool enable_receive_side_bwe);
120 };
121
122 } // namespace webrtc
123
124 #endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698