LCOV - code coverage report
Current view: top level - media/webrtc/signaling/src/mediapipeline - MediaPipelineFilter.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: softtabstop=2:shiftwidth=2:expandtab
       3             :  * */
       4             : /* This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       6             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : // Original author: bcampen@mozilla.com
       9             : 
      10             : #ifndef mediapipelinefilter_h__
      11             : #define mediapipelinefilter_h__
      12             : 
      13             : #include <cstddef>
      14             : #include <stdint.h>
      15             : #include <string>
      16             : 
      17             : #include <set>
      18             : 
      19             : namespace webrtc {
      20             : struct RTPHeader;
      21             : }
      22             : 
      23             : namespace mozilla {
      24             : 
      25             : // A class that handles the work of filtering RTP packets that arrive at a
      26             : // MediaPipeline. This is primarily important for the use of BUNDLE (ie;
      27             : // multiple m-lines share the same RTP stream). There are three ways that this
      28             : // can work;
      29             : //
      30             : // 1) In our SDP, we include a media-level extmap parameter with a unique
      31             : //    integer of our choosing, with the hope that the other side will include
      32             : //    this value in a header in the first few RTP packets it sends us. This
      33             : //    allows us to perform correlation in cases where the other side has not
      34             : //    informed us of the ssrcs it will be sending (either because it did not
      35             : //    include them in its SDP, or their SDP has not arrived yet)
      36             : //    and also gives us the opportunity to learn SSRCs from packets so adorned.
      37             : //
      38             : // 2) If the remote endpoint includes SSRC media-level attributes in its SDP,
      39             : //    we can simply use this information to populate the filter. The only
      40             : //    shortcoming here is when RTP packets arrive before the answer does. See
      41             : //    above.
      42             : //
      43             : // 3) As a fallback, we can try to use payload type IDs to perform correlation,
      44             : //    but only when the type id is unique to this media section.
      45             : //    This too allows us to learn about SSRCs (mostly useful for filtering
      46             : //    sender reports later).
      47           0 : class MediaPipelineFilter {
      48             :  public:
      49             :   MediaPipelineFilter();
      50             : 
      51             :   // Checks whether this packet passes the filter, possibly updating the filter
      52             :   // in the process (if the correlator or payload types are used, they can teach
      53             :   // the filter about ssrcs)
      54             :   bool Filter(const webrtc::RTPHeader& header, uint32_t correlator = 0);
      55             : 
      56             :   // RTCP doesn't have things like the RTP correlator, and uses its own
      57             :   // payload types too.
      58             :   bool FilterSenderReport(const unsigned char* data, size_t len) const;
      59             : 
      60             :   void AddRemoteSSRC(uint32_t ssrc);
      61             :   void AddRemoteRtpStreamId(const std::string& rtp_strm_id);
      62             : 
      63             :   // When a payload type id is unique to our media section, add it here.
      64             :   void AddUniquePT(uint8_t payload_type);
      65             :   void SetCorrelator(uint32_t correlator);
      66             : 
      67             :   void Update(const MediaPipelineFilter& filter_update);
      68             : 
      69             :   // Some payload types
      70             :   static const uint8_t SENDER_REPORT_T = 200;
      71             : 
      72             :  private:
      73             :   // Payload type is always in the second byte
      74             :   static const size_t PT_OFFSET = 1;
      75             :   // First SSRC always starts at the fifth byte.
      76             :   static const size_t FIRST_SSRC_OFFSET = 4;
      77             : 
      78             :   uint32_t correlator_;
      79             :   // The number of filters we manage here is quite small, so I am optimizing
      80             :   // for readability.
      81             :   std::set<uint32_t> remote_ssrc_set_;
      82             :   std::set<uint8_t> payload_type_set_;
      83             :   std::set<std::string> remote_rid_set_;
      84             : };
      85             : 
      86             : } // end namespace mozilla
      87             : 
      88             : #endif // mediapipelinefilter_h__
      89             : 

Generated by: LCOV version 1.13