LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac - locked_bandwidth_info.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 14 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2015 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             : #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_
      12             : #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_
      13             : 
      14             : #include "webrtc/base/atomicops.h"
      15             : #include "webrtc/base/criticalsection.h"
      16             : #include "webrtc/base/thread_annotations.h"
      17             : #include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h"
      18             : 
      19             : namespace webrtc {
      20             : 
      21             : // An IsacBandwidthInfo that's safe to access from multiple threads because
      22             : // it's protected by a mutex.
      23           0 : class LockedIsacBandwidthInfo final {
      24             :  public:
      25             :   LockedIsacBandwidthInfo();
      26             :   ~LockedIsacBandwidthInfo();
      27             : 
      28           0 :   IsacBandwidthInfo Get() const {
      29           0 :     rtc::CritScope lock(&lock_);
      30           0 :     return bwinfo_;
      31             :   }
      32             : 
      33           0 :   void Set(const IsacBandwidthInfo& bwinfo) {
      34           0 :     rtc::CritScope lock(&lock_);
      35           0 :     bwinfo_ = bwinfo;
      36           0 :   }
      37             : 
      38           0 :   int AddRef() const { return rtc::AtomicOps::Increment(&ref_count_); }
      39             : 
      40           0 :   int Release() const {
      41           0 :     const int count = rtc::AtomicOps::Decrement(&ref_count_);
      42           0 :     if (count == 0) {
      43           0 :       delete this;
      44             :     }
      45           0 :     return count;
      46             :   }
      47             : 
      48             :  private:
      49             :   mutable volatile int ref_count_;
      50             :   rtc::CriticalSection lock_;
      51             :   IsacBandwidthInfo bwinfo_ GUARDED_BY(lock_);
      52             : };
      53             : 
      54             : }  // namespace webrtc
      55             : 
      56             : #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_

Generated by: LCOV version 1.13