Chromium Code Reviews| 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; | |
|
pthatcher1
2017/04/29 00:58:46
Why the name "RtpPacketReceived"? Why not just "R
| |
| 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 }; | |
|
pthatcher1
2017/04/29 00:58:46
Could we, instead, have an RtpHeaderExtensionIdent
nisse-webrtc
2017/05/02 09:34:47
I think we could. It adds one more method call on
| |
| 52 | |
| 53 // This class represents the RTP receive parsing and demuxing, for a | |
|
pthatcher1
2017/04/29 00:58:46
"RTP receive parsing and demuxing". What does "re
nisse-webrtc
2017/05/02 09:34:47
The intent is that this interface is passed to Rec
| |
| 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. | |
| 64 struct Config { | |
| 65 // Send side bandwidth estimation is defined in | |
| 66 // draft-holmer-rmcat-transport-wide-cc-extensions. When invoking | |
| 67 // the ReceiveSideCongestionController, we need to know if | |
| 68 // send-side bwe is configured or not. | |
| 69 bool use_send_side_bwe = false; | |
| 70 }; | |
| 71 | |
| 72 // Creates the default implementation. | |
| 73 static std::unique_ptr<RtpTransportControllerReceiveInterface> Create( | |
| 74 ReceiveSideCongestionController* receive_side_cc, | |
| 75 bool enable_receive_side_bwe); | |
| 76 | |
| 77 virtual ~RtpTransportControllerReceiveInterface() {} | |
| 78 | |
| 79 // Registers the receiver responsible for an ssrc. | |
| 80 virtual void AddReceiver(uint32_t ssrc, | |
| 81 const Config& config, | |
|
pthatcher1
2017/04/29 00:58:46
Is this going to do full demux using MID, SSRCs, a
| |
| 82 RtpPacketReceiverInterface* receiver) = 0; | |
| 83 // TODO(nisse): It's unclear what info is conveniently available at | |
| 84 // remove time. For now, we take only the |receiver| pointer and | |
| 85 // iterate over the mapping. | |
| 86 virtual void RemoveReceiver(const RtpPacketReceiverInterface* receiver) = 0; | |
| 87 | |
| 88 // Used to represent auxillary sinks, currently used for FlexFec. | |
| 89 // The responsible receiver must be registered first. | |
| 90 virtual void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink) = 0; | |
|
pthatcher1
2017/04/29 00:58:46
Why do we need two separate interfaces for getting
| |
| 91 // TODO(nisse): It's unclear what info is conveniently available at | |
| 92 // remove time. For now, we take only the |receiver| pointer and | |
| 93 // iterate over the mapping. | |
| 94 virtual void RemoveSink(const RtpPacketSinkInterface* sink) = 0; | |
| 95 | |
| 96 // Process raw incoming RTP packets. | |
| 97 // TODO(nisse): DeliveryStatus is needed for the current handling of | |
| 98 // unsignalled ssrcs. Change return type to bool or void, once we do | |
| 99 // that via AddPayload instead. | |
| 100 virtual PacketReceiver::DeliveryStatus OnRtpPacket( | |
| 101 int64_t arrival_time_ms, | |
| 102 rtc::ArrayView<const uint8_t> packet) = 0; | |
| 103 }; | |
| 104 | |
| 105 } // namespace webrtc | |
| 106 | |
| 107 #endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ | |
| OLD | NEW |