xref: /aosp_15_r20/external/webrtc/logging/rtc_event_log/fake_rtc_event_log.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2018 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 "logging/rtc_event_log/fake_rtc_event_log.h"
12 
13 #include <map>
14 #include <memory>
15 
16 #include "api/rtc_event_log/rtc_event_log.h"
17 #include "rtc_base/synchronization/mutex.h"
18 
19 namespace webrtc {
20 
StartLogging(std::unique_ptr<RtcEventLogOutput> output,int64_t output_period_ms)21 bool FakeRtcEventLog::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
22                                    int64_t output_period_ms) {
23   return true;
24 }
25 
StopLogging()26 void FakeRtcEventLog::StopLogging() {}
27 
Log(std::unique_ptr<RtcEvent> event)28 void FakeRtcEventLog::Log(std::unique_ptr<RtcEvent> event) {
29   MutexLock lock(&mu_);
30   ++count_[event->GetType()];
31 }
32 
GetEventCount(RtcEvent::Type event_type)33 int FakeRtcEventLog::GetEventCount(RtcEvent::Type event_type) {
34   MutexLock lock(&mu_);
35   return count_[event_type];
36 }
37 
38 }  // namespace webrtc
39