OLD | NEW |
---|---|
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 #ifndef WEBRTC_CALL_RTP_DEMUXER_H_ | 10 #ifndef WEBRTC_CALL_RTP_DEMUXER_H_ |
11 #define WEBRTC_CALL_RTP_DEMUXER_H_ | 11 #define WEBRTC_CALL_RTP_DEMUXER_H_ |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "webrtc/call/rtp_packet_sink_interface.h" | |
the sun
2017/06/01 07:28:21
forward decl would suffice
nisse-webrtc
2017/06/01 07:48:05
True. Not entirely clear if it makes sense to use
| |
16 | |
15 namespace webrtc { | 17 namespace webrtc { |
16 | 18 |
17 class RtpPacketReceived; | |
18 | |
19 // This class represents a receiver of an already parsed RTP packets. | |
20 class RtpPacketSinkInterface { | |
21 public: | |
22 virtual ~RtpPacketSinkInterface() {} | |
23 virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0; | |
24 }; | |
25 | |
26 // This class represents the RTP demuxing, for a single RTP session (i.e., one | 19 // This class represents the RTP demuxing, for a single RTP session (i.e., one |
27 // ssrc space, see RFC 7656). It isn't thread aware, leaving responsibility of | 20 // ssrc space, see RFC 7656). It isn't thread aware, leaving responsibility of |
28 // multithreading issues to the user of this class. | 21 // multithreading issues to the user of this class. |
29 // TODO(nisse): Should be extended to also do MID-based demux and payload-type | 22 // TODO(nisse): Should be extended to also do MID-based demux and payload-type |
30 // demux. | 23 // demux. |
31 class RtpDemuxer { | 24 class RtpDemuxer { |
32 public: | 25 public: |
33 RtpDemuxer(); | 26 RtpDemuxer(); |
34 ~RtpDemuxer(); | 27 ~RtpDemuxer(); |
35 | 28 |
36 // Registers a sink. The same sink can be registered for multiple ssrcs, and | 29 // Registers a sink. The same sink can be registered for multiple ssrcs, and |
37 // the same ssrc can have multiple sinks. Null pointer is not allowed. | 30 // the same ssrc can have multiple sinks. Null pointer is not allowed. |
38 void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink); | 31 void AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink); |
39 // Removes a sink. Returns deletion count (a sink may be registered | 32 // Removes a sink. Returns deletion count (a sink may be registered |
40 // for multiple ssrcs). Null pointer is not allowed. | 33 // for multiple ssrcs). Null pointer is not allowed. |
41 size_t RemoveSink(const RtpPacketSinkInterface* sink); | 34 size_t RemoveSink(const RtpPacketSinkInterface* sink); |
42 | 35 |
43 // Returns true if at least one matching sink was found, otherwise false. | 36 // Returns true if at least one matching sink was found, otherwise false. |
44 bool OnRtpPacket(const RtpPacketReceived& packet); | 37 bool OnRtpPacket(const RtpPacketReceived& packet); |
45 | 38 |
46 private: | 39 private: |
47 std::multimap<uint32_t, RtpPacketSinkInterface*> sinks_; | 40 std::multimap<uint32_t, RtpPacketSinkInterface*> sinks_; |
48 }; | 41 }; |
49 | 42 |
50 } // namespace webrtc | 43 } // namespace webrtc |
51 | 44 |
52 #endif // WEBRTC_CALL_RTP_DEMUXER_H_ | 45 #endif // WEBRTC_CALL_RTP_DEMUXER_H_ |
OLD | NEW |