| Index: webrtc/call/rtp_demuxer.h
|
| diff --git a/webrtc/call/rtp_demuxer.h b/webrtc/call/rtp_demuxer.h
|
| index 2c9b7252799d27bd8b4fb61372e39aa02aa69a5d..a5ba889a039b83a85a496acae20edf068fac23ed 100644
|
| --- a/webrtc/call/rtp_demuxer.h
|
| +++ b/webrtc/call/rtp_demuxer.h
|
| @@ -7,10 +7,13 @@
|
| * 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_DEMUXER_H_
|
| #define WEBRTC_CALL_RTP_DEMUXER_H_
|
|
|
| #include <map>
|
| +#include <set>
|
| +#include <string>
|
|
|
| namespace webrtc {
|
|
|
| @@ -30,15 +33,43 @@ class RtpDemuxer {
|
| // Registers a sink. The same sink can be registered for multiple ssrcs, and
|
| // the same ssrc can have multiple sinks. Null pointer is not allowed.
|
| void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink);
|
| - // Removes a sink. Returns deletion count (a sink may be registered
|
| - // for multiple ssrcs). Null pointer is not allowed.
|
| - size_t RemoveSink(const RtpPacketSinkInterface* sink);
|
| +
|
| + // Registers a sink's association to an RSID. Null pointer is not allowed.
|
| + void AddSink(const std::string& rsid, RtpPacketSinkInterface* sink);
|
| +
|
| + // Removes a sink. Return value reports if anything was actually removed.
|
| + // Null pointer is not allowed.
|
| + bool RemoveSink(const RtpPacketSinkInterface* sink);
|
|
|
| // Returns true if at least one matching sink was found, otherwise false.
|
| bool OnRtpPacket(const RtpPacketReceived& packet);
|
|
|
| private:
|
| + // Records a sink<->SSRC association. This can happen by explicit
|
| + // configuration by AddSink(ssrc...), or by inferred configuration from an
|
| + // RSID-based configuration which is resolved to an SSRC upon
|
| + // packet reception.
|
| + void RecordSsrcToSinkAssociation(uint32_t ssrc, RtpPacketSinkInterface* sink);
|
| +
|
| + // When a new packet arrives, we attempt to resolve extra associations,
|
| + // such as which RSIDs are associated with which SSRCs.
|
| + void FindSsrcAssociations(const RtpPacketReceived& packet);
|
| +
|
| + // This records the association SSRCs to sinks. Other associations, such
|
| + // as by RSID, also end up here once the RSID, etc., is resolved to an SSRC.
|
| std::multimap<uint32_t, RtpPacketSinkInterface*> sinks_;
|
| +
|
| + // A sink may be associated with an RSID - RTP Stream ID. This tag has a
|
| + // one-to-one association with an SSRC, but that SSRC is not yet known.
|
| + // When it becomes known, the association of the sink to the RSID is deleted
|
| + // from this container, and moved into |sinks_|.
|
| + std::multimap<std::string, RtpPacketSinkInterface*> rsid_sinks_;
|
| +
|
| + // Iterating over |rsid_sinks_| for each incoming and performing multiple
|
| + // string comparisons is of non-trivial cost. To avoid this cost, we only
|
| + // check RSIDs for the first packet on each incoming SSRC stream.
|
| + // (If RSID associations are added later, we check again.)
|
| + std::set<uint32_t> processed_ssrcs_;
|
| };
|
|
|
| } // namespace webrtc
|
|
|