Files
platform-external-webrtc/webrtc/call/rtcp_demuxer.h
eladalon a52722fac4 Reland of Create RtcpDemuxer (patchset #1 id:1 of https://codereview.webrtc.org/2957763002/ )
Reason for revert:
About to fix problem and reland.

Original issue's description:
> Revert of Create RtcpDemuxer (patchset #13 id:240001 of https://codereview.webrtc.org/2943693003/ )
>
> Reason for revert:
> Breaks Chromium FYI bots.
>
> The problem is in the BUILD.gn file.
>
> Sample failure:
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/17829
>
> Sample logs:
> use_goma = true
> """ to /b/c/b/Linux_Builder/src/out/Release/args.gn.
>
> /b/c/b/Linux_Builder/src/buildtools/linux64/gn gen //out/Release --check
>   -> returned 1
> ERROR at //third_party/webrtc/call/BUILD.gn:46:5: Can't load input file.
>     "//webrtc/base:rtc_base_approved",
>     ^--------------------------------
>
> Original issue's description:
> > Create RtcpDemuxer. Capabilities:
> > 1. Demux RTCP messages according to the sender-SSRC.
> > 2. Demux RTCP messages according to the RSID (resolved to an SSRC, then compared to the sender-RTCP).
> > 3. Allow listening in on all RTCP messages passing through the demuxer ("broadcast sinks").
> >
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/2943693003
> > Cr-Commit-Position: refs/heads/master@{#18763}
> > Committed: cb83bdf01f
>
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/2957763002
> Cr-Commit-Position: refs/heads/master@{#18764}
> Committed: 0e7e7869e7

BUG=webrtc:7135

Review-Url: https://codereview.webrtc.org/2960623002
Cr-Commit-Position: refs/heads/master@{#18768}
2017-06-26 18:23:54 +00:00

86 lines
3.4 KiB
C++

/*
* 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_RTCP_DEMUXER_H_
#define WEBRTC_CALL_RTCP_DEMUXER_H_
#include <map>
#include <string>
#include <vector>
#include "webrtc/base/array_view.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/call/rsid_resolution_observer.h"
namespace webrtc {
class RtcpPacketSinkInterface;
// This class represents the RTCP demuxing, for a single RTP session (i.e., one
// SSRC space, see RFC 7656). It isn't thread aware, leaving responsibility of
// multithreading issues to the user of this class.
class RtcpDemuxer : public RsidResolutionObserver {
public:
RtcpDemuxer();
~RtcpDemuxer() override;
// Registers a sink. The sink will be notified of incoming RTCP packets with
// that sender-SSRC. The same sink can be registered for multiple SSRCs, and
// the same SSRC can have multiple sinks. Null pointer is not allowed.
// Sinks may be associated with both an SSRC and an RSID.
// Sinks may be registered as SSRC/RSID-specific or broadcast, but not both.
void AddSink(uint32_t sender_ssrc, RtcpPacketSinkInterface* sink);
// Registers a sink. Once the RSID is resolved to an SSRC, the sink will be
// notified of all RTCP packets with that sender-SSRC.
// The same sink can be registered for multiple RSIDs, and
// the same RSID can have multiple sinks. Null pointer is not allowed.
// Sinks may be associated with both an SSRC and an RSID.
// Sinks may be registered as SSRC/RSID-specific or broadcast, but not both.
void AddSink(const std::string& rsid, RtcpPacketSinkInterface* sink);
// Registers a sink. The sink will be notified of any incoming RTCP packet.
// Null pointer is not allowed.
// Sinks may be registered as SSRC/RSID-specific or broadcast, but not both.
void AddBroadcastSink(RtcpPacketSinkInterface* sink);
// Undo previous AddSink() calls with the given sink.
void RemoveSink(const RtcpPacketSinkInterface* sink);
// Undo AddBroadcastSink().
void RemoveBroadcastSink(const RtcpPacketSinkInterface* sink);
// Process a new RTCP packet and forward it to the appropriate sinks.
void OnRtcpPacket(rtc::ArrayView<const uint8_t> packet);
// Implement RsidResolutionObserver - become notified whenever RSIDs resolve
// to an SSRC.
void OnRsidResolved(const std::string& rsid, uint32_t ssrc) override;
// TODO(eladalon): Add the ability to resolve RSIDs and inform observers,
// like in the RtpDemuxer case, once the relevant standard is finalized.
private:
// Records the association SSRCs to sinks.
std::multimap<uint32_t, RtcpPacketSinkInterface*> ssrc_sinks_;
// Records the association RSIDs to sinks.
std::multimap<std::string, RtcpPacketSinkInterface*> rsid_sinks_;
// Sinks which will receive notifications of all incoming RTCP packets.
// Additional/removal of sinks is expected to be significantly less frequent
// than RTCP message reception; container chosen for iteration performance.
std::vector<RtcpPacketSinkInterface*> broadcast_sinks_;
};
} // namespace webrtc
#endif // WEBRTC_CALL_RTCP_DEMUXER_H_