LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source - rtp_header_parser.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 23 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
       3             :  *
       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
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
      11             : 
      12             : #include "webrtc/base/criticalsection.h"
      13             : #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
      14             : #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
      15             : 
      16             : namespace webrtc {
      17             : 
      18             : class RtpHeaderParserImpl : public RtpHeaderParser {
      19             :  public:
      20             :   RtpHeaderParserImpl();
      21           0 :   virtual ~RtpHeaderParserImpl() {}
      22             : 
      23             :   bool Parse(const uint8_t* packet,
      24             :              size_t length,
      25             :              RTPHeader* header) const override;
      26             : 
      27             :   bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id) override;
      28             : 
      29             :   bool DeregisterRtpHeaderExtension(RTPExtensionType type) override;
      30             : 
      31             :  private:
      32             :   rtc::CriticalSection critical_section_;
      33             :   RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(critical_section_);
      34             : };
      35             : 
      36           0 : RtpHeaderParser* RtpHeaderParser::Create() {
      37           0 :   return new RtpHeaderParserImpl;
      38             : }
      39             : 
      40           0 : RtpHeaderParserImpl::RtpHeaderParserImpl() {}
      41             : 
      42           0 : bool RtpHeaderParser::IsRtcp(const uint8_t* packet, size_t length) {
      43           0 :   RtpUtility::RtpHeaderParser rtp_parser(packet, length);
      44           0 :   return rtp_parser.RTCP();
      45             : }
      46             : 
      47           0 : bool RtpHeaderParserImpl::Parse(const uint8_t* packet,
      48             :                                 size_t length,
      49             :                                 RTPHeader* header) const {
      50           0 :   RtpUtility::RtpHeaderParser rtp_parser(packet, length);
      51           0 :   memset(header, 0, sizeof(*header));
      52             : 
      53           0 :   RtpHeaderExtensionMap map;
      54             :   {
      55           0 :     rtc::CritScope cs(&critical_section_);
      56           0 :     map = rtp_header_extension_map_;
      57             :   }
      58             : 
      59           0 :   const bool valid_rtpheader = rtp_parser.Parse(header, &map);
      60           0 :   if (!valid_rtpheader) {
      61           0 :     return false;
      62             :   }
      63           0 :   return true;
      64             : }
      65             : 
      66           0 : bool RtpHeaderParserImpl::RegisterRtpHeaderExtension(RTPExtensionType type,
      67             :                                                      uint8_t id) {
      68           0 :   rtc::CritScope cs(&critical_section_);
      69           0 :   return rtp_header_extension_map_.RegisterByType(id, type);
      70             : }
      71             : 
      72           0 : bool RtpHeaderParserImpl::DeregisterRtpHeaderExtension(RTPExtensionType type) {
      73           0 :   rtc::CritScope cs(&critical_section_);
      74           0 :   return rtp_header_extension_map_.Deregister(type) == 0;
      75             : }
      76             : }  // namespace webrtc

Generated by: LCOV version 1.13