Chromium Code Reviews| Index: webrtc/call/rtp_transport_controller_receive.h |
| diff --git a/webrtc/call/rtp_transport_controller_receive.h b/webrtc/call/rtp_transport_controller_receive.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..961519374bbba59165af981d1a901d9f6ef9dcf7 |
| --- /dev/null |
| +++ b/webrtc/call/rtp_transport_controller_receive.h |
| @@ -0,0 +1,119 @@ |
| +/* |
| + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| +#ifndef WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ |
| +#define WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ |
| + |
| +#include <memory> |
| + |
| +#include "webrtc/base/array_view.h" |
| + |
| +// For DeliveryStatus. |
| +// TODO(nisse): This file ought to not depend on call. |
| +#include "webrtc/call/call.h" |
| + |
| +namespace webrtc { |
| + |
| +class ReceiveSideCongestionController; |
| +class RtpPacketReceived; |
| + |
| +// This class represents a receiver of already parsed RTP packets. |
| +class RtpPacketSinkInterface { |
| + public: |
| + virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0; |
| + 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.
|
| +}; |
| + |
| +// TODO(nisse): This additional interface may be a bit confusing, it's |
| +// needed because RTP extensions are currently associated with each |
| +// stream. We should be able to identify extensions earlier, since the |
| +// mapping is the same for all streams on the same transport. Then we |
| +// can delete this class, replacing it with RtpPacketSinkInterface. |
| +// There's also the subtlety that the per-transport negotiation may |
| +// differ from the extensions expected for a particular stream, and we |
| +// may have code that breaks if we identify extension which is not |
| +// consistent with the configuration of the stream. |
| + |
| +// This class represents a receiver of RTP packets, which has the |
| +// additional responsibility of identifying extension headers. I.e., |
| +// the caller of OnRtpPacketReceive is expected to have called |
| +// packet->Parse, but not packet->IdentifyExtensions. |
| +class RtpPacketReceiverInterface { |
| + public: |
| + virtual bool OnRtpPacketReceive(RtpPacketReceived* packet) = 0; |
| + virtual ~RtpPacketReceiverInterface() {} |
| +}; |
| + |
| +// This class represents the RTP receive parsing and demuxing, for a |
| +// single transport. It isn't thread aware, leaving responsibility of |
| +// multithreading issues to the user of this class. TODO(nisse): Add |
| +// RTCP processing, we should aim to terminate RTCP and not leave any |
| +// RTCP processing to individual receive streams. TODO(nisse): Extract |
| +// parsing and demuxing logic into separate classes. A demuxer should |
| +// handle only a single transport. |
| +class RtpTransportControllerReceiveInterface { |
| + public: |
| + // Configuration needed for media-independent processing of received |
| + // packets, in particular, feeding information to the congestion |
| + // controller. |
| + |
| + // TODO(nisse): It turns out this data is only used for the callback |
| + // to the ReceiveSideCongestionController. |
| + struct Config { |
|
danilchap
2017/04/19 15:45:25
is there plan to make it TransportController confi
|
| + // See draft-holmer-rmcat-transport-wide-cc-extensions for details. |
| + bool use_send_side_bwe = false; |
| + }; |
| + |
| + // Registers the receiver responsible for an ssrc. |
| + virtual void AddReceiver(uint32_t ssrc, |
| + const Config& config, |
| + RtpPacketReceiverInterface* receiver) = 0; |
| + // TODO(nisse): It's unclear what info is conveniently available at |
| + // remove time. For now, we take only the |receiver| pointer and |
| + // iterate over the mapping. |
| + virtual void RemoveReceiver(const RtpPacketReceiverInterface* receiver) = 0; |
| + |
| + // Used to represent auxillary sinks, currently used for FlexFec. |
| + // The responsible receiver must be registered first. |
| + virtual void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink) = 0; |
| + // TODO(nisse): It's unclear what info is conveniently available at |
| + // remove time. For now, we take only the |receiver| pointer and |
| + // iterate over the mapping. |
| + virtual void RemoveSink(const RtpPacketSinkInterface* sink) = 0; |
| + |
| +#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.
|
| + // TODO(nisse): Not yet implemented. We also need something similar to |
| + // handle the mid extension. |
| + // Incoming packets with unknown ssrcs represent unsignalled |
| + // streams. We dispatch on payload type and media type. The receiver |
| + // will typically create a new RtpReceiver to pass the packet to. A |
| + // true return value from the callback means that we should retry |
| + // lookup. |
| + virtual void AddPayload(uint8_t payload_type, |
| + RtpPacketReceiverInterface *receiver) = 0; |
| +#endif |
| + // Process raw incoming RTP packets. |
| + // TODO(nisse): DeliveryStatus is needed for the current handling of |
| + // unsignalled ssrcs. Change return type to bool or void, once we do |
| + // that via AddPayload instead. |
| + virtual PacketReceiver::DeliveryStatus OnRtpPacket( |
| + int64_t arrival_time_ms, |
| + rtc::ArrayView<const uint8_t> packet) = 0; |
| + |
| + virtual ~RtpTransportControllerReceiveInterface() {} |
| + |
| + // Creates the default implementation. |
| + static std::unique_ptr<RtpTransportControllerReceiveInterface> Create( |
| + ReceiveSideCongestionController* receive_side_cc, |
| + bool enable_receive_side_bwe); |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_RECEIVE_H_ |