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

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

Issue 2943693003: Create RtcpDemuxer (Closed)
Patch Set: git cl format Created 3 years, 6 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
11 #ifndef WEBRTC_CALL_RTCP_DEMUXER_H_
12 #define WEBRTC_CALL_RTCP_DEMUXER_H_
13
14 #include <map>
15 #include <string>
16 #include <vector>
17
18 #include "webrtc/base/array_view.h"
19 #include "webrtc/base/basictypes.h"
20 #include "webrtc/call/rsid_ssrc_association_resolution_observer.h"
21
22 namespace webrtc {
23
24 class RtcpPacketSinkInterface;
25
26 // This class represents the RTCP demuxing, for a single RTP session (i.e., one
27 // SSRC space, see RFC 7656). It isn't thread aware, leaving responsibility of
28 // multithreading issues to the user of this class.
29 class RtcpDemuxer : public RsidResolutionObserver {
30 public:
31 RtcpDemuxer();
32 ~RtcpDemuxer() override;
33
34 // Registers a sink. The sink will be notified of incoming RTCP packets with
35 // that sender-SSRC. The same sink can be registered for multiple SSRCs, and
36 // the same SSRC can have multiple sinks. Null pointer is not allowed.
37 // Sinks may be associated with both an SSRC and an RSID.
38 // Sinks may be registered as SSRC/RSID-specific or broadcast, but not both.
39 void AddSink(uint32_t sender_ssrc, RtcpPacketSinkInterface* sink);
40
41 // Registers a sink. Once the RSID is resolved to an SSRC, the sink will be
42 // notified of all RTCP packets with that sender-SSRC.
43 // The same sink can be registered for multiple RSIDs, and
44 // the same RSID can have multiple sinks. Null pointer is not allowed.
45 // Sinks may be associated with both an SSRC and an RSID.
46 // Sinks may be registered as SSRC/RSID-specific or broadcast, but not both.
47 void AddSink(const std::string& rsid, RtcpPacketSinkInterface* sink);
48
49 // Registers a sink. The sink will be notified of any incoming RTCP packet.
50 // Null pointer is not allowed.
51 // Sinks may be associated with both an SSRC and an RSID.
52 // Sinks may be registered as SSRC/RSID-specific or broadcast, but not both.
53 void AddBroadcastSink(RtcpPacketSinkInterface* sink);
54
55 // Undo previous AddSink() calls with the given sink.
56 void RemoveSink(const RtcpPacketSinkInterface* sink);
57
58 // Undo AddBroadcastSink().
59 void RemoveBroadcastSink(const RtcpPacketSinkInterface* sink);
60
61 // Process a new RTCP packet and forward it to the appropriate sinks.
62 void OnRtcpPacket(rtc::ArrayView<const uint8_t> packet);
63
64 // Implement RsidResolutionObserver - become notified whenever RSIDs resolve
65 // to an SSRC.
66 void OnRsidResolved(const std::string& rsid, uint32_t ssrc) override;
67
68 // TODO(eladalon): Add the ability to resolve RSIDs and inform observers,
69 // like in the RtpDemuxer case, once the relevant standard is finalized.
70
71 private:
72 // Records the association SSRCs to sinks.
73 std::multimap<uint32_t, RtcpPacketSinkInterface*> ssrc_sinks_;
nisse-webrtc 2017/06/16 13:18:34 I'm not sure what the use cases are, but do we rea
eladalon 2017/06/16 15:18:43 For posterity - discussed offline between Dani, El
eladalon 2017/06/16 15:19:36 *Danil
74
75 // Records the association RSIDs to sinks.
76 std::multimap<std::string, RtcpPacketSinkInterface*> rsid_sinks_;
77
78 // Sinks which will receive notifications of all incoming RTCP packets.
79 // Additional/removal of sinks is expected to be significantly less frequent
80 // than RTCP message reception; container chosen for iteration performance.
81 std::vector<RtcpPacketSinkInterface*> broadcast_sinks_;
82 };
83
84 } // namespace webrtc
85
86 #endif // WEBRTC_CALL_RTCP_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698