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

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

Issue 2709723003: Initial implementation of RtpTransportControllerReceive and related interfaces.
Patch Set: Add return statement, to please windows compiler. 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.
27 class RtpPacketSinkInterface {
28 public:
29 virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0;
30 virtual ~RtpPacketSinkInterface() {}
danilchap 2017/04/19 15:45:25 in all 3 classes in this file prefer default order
nisse-webrtc 2017/04/20 10:53:38 Done.
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 {
danilchap 2017/04/19 15:45:25 is there plan to make it TransportController confi
69 // See draft-holmer-rmcat-transport-wide-cc-extensions for details.
70 bool use_send_side_bwe = false;
71 };
72
73 // Registers the receiver responsible for an ssrc.
74 virtual void AddReceiver(uint32_t ssrc,
75 const Config& config,
76 RtpPacketReceiverInterface* receiver) = 0;
77 // TODO(nisse): It's unclear what info is conveniently available at
78 // remove time. For now, we take only the |receiver| pointer and
79 // iterate over the mapping.
80 virtual void RemoveReceiver(const RtpPacketReceiverInterface* receiver) = 0;
81
82 // Used to represent auxillary sinks, currently used for FlexFec.
83 // The responsible receiver must be registered first.
84 virtual void AddSink(uint32_t ssrc, 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 void RemoveSink(const RtpPacketSinkInterface* sink) = 0;
89
90 #if 0
danilchap 2017/04/19 15:45:25 better to remove for now and add when it will be u
nisse-webrtc 2017/04/20 10:53:38 Done.
91 // TODO(nisse): Not yet implemented. We also need something similar to
92 // handle the mid extension.
93 // Incoming packets with unknown ssrcs represent unsignalled
94 // streams. We dispatch on payload type and media type. The receiver
95 // will typically create a new RtpReceiver to pass the packet to. A
96 // true return value from the callback means that we should retry
97 // lookup.
98 virtual void AddPayload(uint8_t payload_type,
99 RtpPacketReceiverInterface *receiver) = 0;
100 #endif
101 // Process raw incoming RTP packets.
102 // TODO(nisse): DeliveryStatus is needed for the current handling of
103 // unsignalled ssrcs. Change return type to bool or void, once we do
104 // that via AddPayload instead.
105 virtual PacketReceiver::DeliveryStatus OnRtpPacket(
106 int64_t arrival_time_ms,
107 rtc::ArrayView<const uint8_t> packet) = 0;
108
109 virtual ~RtpTransportControllerReceiveInterface() {}
110
111 // Creates the default implementation.
112 static std::unique_ptr<RtpTransportControllerReceiveInterface> Create(
113 ReceiveSideCongestionController* receive_side_cc,
114 bool enable_receive_side_bwe);
115 };
116
117 } // namespace webrtc
118
119 #endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698