• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2017 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_EVENTS_RTC_EVENT_PROBE_CLUSTER_CREATED_H_
12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_CLUSTER_CREATED_H_
13 
14 #include <stdint.h>
15 
16 #include <memory>
17 #include <string>
18 #include <vector>
19 
20 #include "absl/strings/string_view.h"
21 #include "api/rtc_event_log/rtc_event.h"
22 #include "api/units/timestamp.h"
23 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
24 
25 namespace webrtc {
26 
27 struct LoggedBweProbeClusterCreatedEvent {
28   LoggedBweProbeClusterCreatedEvent() = default;
LoggedBweProbeClusterCreatedEventLoggedBweProbeClusterCreatedEvent29   LoggedBweProbeClusterCreatedEvent(Timestamp timestamp,
30                                     int32_t id,
31                                     int32_t bitrate_bps,
32                                     uint32_t min_packets,
33                                     uint32_t min_bytes)
34       : timestamp(timestamp),
35         id(id),
36         bitrate_bps(bitrate_bps),
37         min_packets(min_packets),
38         min_bytes(min_bytes) {}
39 
log_time_usLoggedBweProbeClusterCreatedEvent40   int64_t log_time_us() const { return timestamp.us(); }
log_time_msLoggedBweProbeClusterCreatedEvent41   int64_t log_time_ms() const { return timestamp.ms(); }
log_timeLoggedBweProbeClusterCreatedEvent42   Timestamp log_time() const { return timestamp; }
43 
44   Timestamp timestamp = Timestamp::MinusInfinity();
45   int32_t id;
46   int32_t bitrate_bps;
47   uint32_t min_packets;
48   uint32_t min_bytes;
49 };
50 
51 class RtcEventProbeClusterCreated final : public RtcEvent {
52  public:
53   static constexpr Type kType = Type::ProbeClusterCreated;
54 
55   RtcEventProbeClusterCreated(int32_t id,
56                               int32_t bitrate_bps,
57                               uint32_t min_probes,
58                               uint32_t min_bytes);
59   ~RtcEventProbeClusterCreated() override = default;
60 
GetType()61   Type GetType() const override { return kType; }
IsConfigEvent()62   bool IsConfigEvent() const override { return false; }
63 
64   std::unique_ptr<RtcEventProbeClusterCreated> Copy() const;
65 
id()66   int32_t id() const { return id_; }
bitrate_bps()67   int32_t bitrate_bps() const { return bitrate_bps_; }
min_probes()68   uint32_t min_probes() const { return min_probes_; }
min_bytes()69   uint32_t min_bytes() const { return min_bytes_; }
70 
Encode(rtc::ArrayView<const RtcEvent * > batch)71   static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) {
72     // TODO(terelius): Implement
73     return "";
74   }
75 
Parse(absl::string_view encoded_bytes,bool batched,std::vector<LoggedBweProbeClusterCreatedEvent> & output)76   static RtcEventLogParseStatus Parse(
77       absl::string_view encoded_bytes,
78       bool batched,
79       std::vector<LoggedBweProbeClusterCreatedEvent>& output) {
80     // TODO(terelius): Implement
81     return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__);
82   }
83 
84  private:
85   RtcEventProbeClusterCreated(const RtcEventProbeClusterCreated& other);
86 
87   const int32_t id_;
88   const int32_t bitrate_bps_;
89   const uint32_t min_probes_;
90   const uint32_t min_bytes_;
91 };
92 
93 }  // namespace webrtc
94 
95 #endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_CLUSTER_CREATED_H_
96