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

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2011 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             : 
      11             : #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h"
      12             : #include "webrtc/base/timeutils.h"
      13             : #include "webrtc/base/checks.h"
      14             : 
      15             : namespace webrtc {
      16             : 
      17           0 : SSRCDatabase* SSRCDatabase::GetSSRCDatabase() {
      18           0 :   return GetStaticInstance<SSRCDatabase>(kAddRef);
      19             : }
      20             : 
      21           0 : void SSRCDatabase::ReturnSSRCDatabase() {
      22           0 :   GetStaticInstance<SSRCDatabase>(kRelease);
      23           0 : }
      24             : 
      25           0 : uint32_t SSRCDatabase::CreateSSRC() {
      26           0 :   rtc::CritScope lock(&crit_);
      27             : 
      28             :   while (true) {  // Try until get a new ssrc.
      29             :     // 0 and 0xffffffff are invalid values for SSRC.
      30           0 :     uint32_t ssrc = random_.Rand(1u, 0xfffffffe);
      31           0 :     if (ssrcs_.insert(ssrc).second) {
      32           0 :       return ssrc;
      33             :     }
      34           0 :   }
      35             : }
      36             : 
      37           0 : void SSRCDatabase::RegisterSSRC(uint32_t ssrc) {
      38           0 :   rtc::CritScope lock(&crit_);
      39           0 :   ssrcs_.insert(ssrc);
      40           0 : }
      41             : 
      42           0 : void SSRCDatabase::ReturnSSRC(uint32_t ssrc) {
      43           0 :   rtc::CritScope lock(&crit_);
      44           0 :   ssrcs_.erase(ssrc);
      45           0 : }
      46             : 
      47           0 : SSRCDatabase::SSRCDatabase() : random_(rtc::TimeMicros()) {}
      48             : 
      49           0 : SSRCDatabase::~SSRCDatabase() {}
      50             : 
      51             : }  // namespace webrtc

Generated by: LCOV version 1.13