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