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

Unified Diff: webrtc/call/rtp_demuxer.h

Issue 2867943003: New class RtpDemuxer and RtpPacketSinkInterface, use in Call. (Closed)
Patch Set: Fix use-after-free crash in av sync. 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..2e90cf63ea481e1e5e436b087857298a59055837
--- /dev/null
+++ b/webrtc/call/rtp_demuxer.h
@@ -0,0 +1,50 @@
+/*
+ * 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
pthatcher1 2017/05/10 00:04:21 We should define "transport" here. I think you me
nisse-webrtc 2017/05/10 07:41:32 I mean one SSRC space, and my understanding is tha
Taylor Brandstetter 2017/05/10 20:59:43 RTP session? From RFC7656: "An RTP session shares
pthatcher1 2017/05/12 00:38:51 That's exactly what I meant. Basically quote/refe
+// isn't thread aware, leaving responsibility of multithreading issues
+// to the user of this class.
+class RtpDemuxer {
+ public:
+ RtpDemuxer();
+ virtual ~RtpDemuxer();
danilchap 2017/05/09 09:20:22 why this class has virtual functions?
nisse-webrtc 2017/05/09 12:11:49 It's not needed for now, I'll remove virtual. (To
+
+ // Registers a sink. The same sink can be registered for multiple ssrcs.
+ virtual void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink);
pthatcher1 2017/05/10 00:04:21 What happens if a single SSRC has multiple sinks a
nisse-webrtc 2017/05/10 07:41:32 We can have multiple sinks for the same ssrc, e.g,
pthatcher1 2017/05/12 00:38:51 Could you make that clear in the comment?
nisse-webrtc 2017/05/12 08:50:08 I'm updating the comments to say that null pointer
+ // TODO(nisse): It's unclear what info is conveniently available at
+ // remove time. For now, we take only the |receiver| pointer and
+ // iterate over the mapping.
+ virtual void RemoveSink(const RtpPacketSinkInterface* sink);
+
+ // Returns true if at least one matching sink was found, otherwise false.
+ virtual 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