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

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

Issue 2993053002: Reland of SSRC and RSID may only refer to one sink each in RtpDemuxer (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « no previous file | webrtc/call/rtp_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 13 matching lines...) Expand all
24 // This class represents the RTP demuxing, for a single RTP session (i.e., one 24 // This class represents the RTP demuxing, for a single RTP session (i.e., one
25 // ssrc space, see RFC 7656). It isn't thread aware, leaving responsibility of 25 // ssrc space, see RFC 7656). It isn't thread aware, leaving responsibility of
26 // multithreading issues to the user of this class. 26 // multithreading issues to the user of this class.
27 // TODO(nisse): Should be extended to also do MID-based demux and payload-type 27 // TODO(nisse): Should be extended to also do MID-based demux and payload-type
28 // demux. 28 // demux.
29 class RtpDemuxer { 29 class RtpDemuxer {
30 public: 30 public:
31 RtpDemuxer(); 31 RtpDemuxer();
32 ~RtpDemuxer(); 32 ~RtpDemuxer();
33 33
34 // Registers a sink. The same sink can be registered for multiple ssrcs, and 34 // Registers a sink. Multiple SSRCs may be mapped to the same sink, but
35 // the same ssrc can have multiple sinks. Null pointer is not allowed. 35 // each SSRC may only be mapped to one sink. The return value reports
36 void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink); 36 // whether the association has been recorded or rejected. Rejection may occur
37 // if the SSRC has already been associated with a sink. The previously added
38 // sink is *not* forgotten.
39 bool AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink);
37 40
38 // Registers a sink's association to an RSID. Null pointer is not allowed. 41 // Registers a sink's association to an RSID. Only one sink may be associated
42 // with a given RSID. Null pointer is not allowed.
39 void AddSink(const std::string& rsid, RtpPacketSinkInterface* sink); 43 void AddSink(const std::string& rsid, RtpPacketSinkInterface* sink);
40 44
41 // Removes a sink. Return value reports if anything was actually removed. 45 // Removes a sink. Return value reports if anything was actually removed.
42 // Null pointer is not allowed. 46 // Null pointer is not allowed.
43 bool RemoveSink(const RtpPacketSinkInterface* sink); 47 bool RemoveSink(const RtpPacketSinkInterface* sink);
44 48
45 // Returns true if at least one matching sink was found. 49 // Handles RTP packets. Returns true if at least one matching sink was found.
46 bool OnRtpPacket(const RtpPacketReceived& packet); 50 bool OnRtpPacket(const RtpPacketReceived& packet);
47 51
48 // Allows other objects to be notified when RSID-SSRC associations are 52 // Allows other objects to be notified when RSID-SSRC associations are
49 // resolved by this object. 53 // resolved by this object.
50 void RegisterRsidResolutionObserver(RsidResolutionObserver* observer); 54 void RegisterRsidResolutionObserver(RsidResolutionObserver* observer);
51 55
52 // Undo a previous RegisterRsidResolutionObserver(). 56 // Undo a previous RegisterRsidResolutionObserver().
53 void DeregisterRsidResolutionObserver(const RsidResolutionObserver* observer); 57 void DeregisterRsidResolutionObserver(const RsidResolutionObserver* observer);
54 58
55 private: 59 private:
56 // Records a sink<->SSRC association. This can happen by explicit
57 // configuration by AddSink(ssrc...), or by inferred configuration from an
58 // RSID-based configuration which is resolved to an SSRC upon
59 // packet reception.
60 void RecordSsrcToSinkAssociation(uint32_t ssrc, RtpPacketSinkInterface* sink);
61
62 // Find the associations of RSID to SSRCs. 60 // Find the associations of RSID to SSRCs.
63 void ResolveRsidToSsrcAssociations(const RtpPacketReceived& packet); 61 void ResolveRsidToSsrcAssociations(const RtpPacketReceived& packet);
64 62
65 // Notify observers of the resolution of an RSID to an SSRC. 63 // Notify observers of the resolution of an RSID to an SSRC.
66 void NotifyObserversOfRsidResolution(const std::string& rsid, uint32_t ssrc); 64 void NotifyObserversOfRsidResolution(const std::string& rsid, uint32_t ssrc);
67 65
68 // This records the association SSRCs to sinks. Other associations, such 66 // This records the association SSRCs to sinks. Other associations, such
69 // as by RSID, also end up here once the RSID, etc., is resolved to an SSRC. 67 // as by RSID, also end up here once the RSID, etc., is resolved to an SSRC.
70 std::multimap<uint32_t, RtpPacketSinkInterface*> ssrc_sinks_; 68 std::map<uint32_t, RtpPacketSinkInterface*> ssrc_sinks_;
71 69
72 // A sink may be associated with an RSID - RTP Stream ID. This tag has a 70 // A sink may be associated with an RSID - RTP Stream ID. This tag has a
73 // one-to-one association with an SSRC, but that SSRC is not yet known. 71 // one-to-one association with an SSRC, but that SSRC is not yet known.
74 // When it becomes known, the association of the sink to the RSID is deleted 72 // When it becomes known, the association of the sink to the RSID is deleted
75 // from this container, and moved into |ssrc_sinks_|. 73 // from this container, and moved into |ssrc_sinks_|.
76 std::multimap<std::string, RtpPacketSinkInterface*> rsid_sinks_; 74 std::map<std::string, RtpPacketSinkInterface*> rsid_sinks_;
77 75
78 // Observers which will be notified when an RSID association to an SSRC is 76 // Observers which will be notified when an RSID association to an SSRC is
79 // resolved by this object. 77 // resolved by this object.
80 std::vector<RsidResolutionObserver*> rsid_resolution_observers_; 78 std::vector<RsidResolutionObserver*> rsid_resolution_observers_;
81 }; 79 };
82 80
83 } // namespace webrtc 81 } // namespace webrtc
84 82
85 #endif // WEBRTC_CALL_RTP_DEMUXER_H_ 83 #endif // WEBRTC_CALL_RTP_DEMUXER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/call/rtp_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698