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

Unified Diff: webrtc/call/rtp_demuxer.h

Issue 2867943003: New class RtpDemuxer and RtpPacketSinkInterface, use in Call. (Closed)
Patch Set: Address danil's comments. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/call/rtp_demuxer.h
diff --git a/webrtc/call/rtp_demuxer.h b/webrtc/call/rtp_demuxer.h
new file mode 100644
index 0000000000000000000000000000000000000000..859cb3d2792194d72af4546f424c1b66a5f9e3cb
--- /dev/null
+++ b/webrtc/call/rtp_demuxer.h
@@ -0,0 +1,49 @@
+/*
+ * 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_DEMUXER_H_
+#define WEBRTC_CALL_RTP_DEMUXER_H_
+
+#include <map>
+
+namespace webrtc {
+
+class RtpPacketReceived;
+
+// This class represents a receiver of an already parsed RTP packets.
+class RtpPacketSinkInterface {
+ public:
+ virtual ~RtpPacketSinkInterface() {}
+ virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0;
+};
+
+// This class represents the RTP demuxing, for a single transport. It
+// isn't thread aware, leaving responsibility of multithreading issues
+// to the user of this class.
Taylor Brandstetter 2017/05/10 20:59:43 Could you mention in a comment that this should al
nisse-webrtc 2017/05/12 08:50:08 I'm adding a TODO. Have I got this right, that pay
Taylor Brandstetter 2017/05/12 16:36:17 Correct. Though JSEP no longer requires SSRC signa
+class RtpDemuxer {
+ public:
+ RtpDemuxer();
+ ~RtpDemuxer();
+
+ // Registers a sink. The same sink can be registered for multiple ssrcs.
+ void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink);
+ // Removes a sink. Returns deletion count (a sink may be registered
+ // for multiple ssrcs).
+ size_t RemoveSink(const RtpPacketSinkInterface* sink);
+
+ // Returns true if at least one matching sink was found, otherwise false.
+ bool OnRtpPacket(const RtpPacketReceived& packet);
+
+ private:
+ std::multimap<uint32_t, RtpPacketSinkInterface*> sinks_;
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_CALL_RTP_DEMUXER_H_

Powered by Google App Engine
This is Rietveld 408576698