Index: webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h |
diff --git a/webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h b/webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h |
index 6bb32c99ed965145c0259f96fc04006bf2acb6e7..1ab5ae9d639a8f50a1b1a0fb4b2bddb09431bcb4 100644 |
--- a/webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h |
+++ b/webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h |
@@ -11,6 +11,7 @@ |
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_ |
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_ |
+#include "webrtc/base/atomicops.h" |
#include "webrtc/base/criticalsection.h" |
#include "webrtc/base/thread_annotations.h" |
#include "webrtc/modules/audio_coding/codecs/isac/bandwidth_info.h" |
@@ -34,7 +35,18 @@ class LockedIsacBandwidthInfo final { |
bwinfo_ = bwinfo; |
} |
+ int AddRef() const { return rtc::AtomicOps::Increment(&ref_count_); } |
+ |
+ int Release() const { |
+ const int count = rtc::AtomicOps::Decrement(&ref_count_); |
+ if (count == 0) { |
+ delete this; |
+ } |
+ return count; |
+ } |
+ |
private: |
+ mutable volatile int ref_count_; |
rtc::CriticalSection lock_; |
IsacBandwidthInfo bwinfo_ GUARDED_BY(lock_); |
}; |