xref: /aosp_15_r20/external/webrtc/logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2021 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 LOGGING_RTC_EVENT_LOG_ENCODER_RTC_EVENT_LOG_ENCODER_V3_H_
12 #define LOGGING_RTC_EVENT_LOG_ENCODER_RTC_EVENT_LOG_ENCODER_V3_H_
13 
14 #include <deque>
15 #include <map>
16 #include <memory>
17 #include <string>
18 
19 #include "api/array_view.h"
20 #include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
21 #include "logging/rtc_event_log/events/rtc_event_definition.h"
22 
23 namespace webrtc {
24 
25 class RtcEventLogEncoderV3 final : public RtcEventLogEncoder {
26  public:
27   RtcEventLogEncoderV3();
28   ~RtcEventLogEncoderV3() override = default;
29 
30   std::string EncodeBatch(
31       std::deque<std::unique_ptr<RtcEvent>>::const_iterator begin,
32       std::deque<std::unique_ptr<RtcEvent>>::const_iterator end) override;
33 
34   std::string EncodeLogStart(int64_t timestamp_us,
35                              int64_t utc_time_us) override;
36   std::string EncodeLogEnd(int64_t timestamp_us) override;
37 
38  private:
39   std::map<RtcEvent::Type,
40            std::function<std::string(rtc::ArrayView<const RtcEvent*>)>>
41       encoders_;
42 };
43 
44 }  // namespace webrtc
45 
46 #endif  // LOGGING_RTC_EVENT_LOG_ENCODER_RTC_EVENT_LOG_ENCODER_V3_H_
47