Shaka Player Embedded
stats.cc
Go to the documentation of this file.
1 // Copyright 2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // AUTO-GENERATED: DO NOT EDIT
16 
17 #include "shaka/stats.h"
18 
19 #include "src/js/stats.h"
20 
21 namespace shaka {
22 
24  public:
25  const double timestamp{};
26  const double id{};
27  const std::string type{};
28  const bool fromAdaptation{};
30 
31  Impl() {}
32  Impl(js::TrackChoice&& internal)
33  : timestamp(std::move(internal.timestamp)),
34  id(std::move(internal.id)),
35  type(std::move(internal.type)),
37  bandwidth(std::move(internal.bandwidth)) {}
38 };
39 
40 TrackChoice::TrackChoice() : impl_(new Impl) {}
41 TrackChoice::TrackChoice(js::TrackChoice&& internal) : impl_(new Impl{std::move(internal)}) {}
42 TrackChoice::TrackChoice(const TrackChoice&) = default;
45 
48 
49 double TrackChoice::timestamp() const {
50  return impl_->timestamp;
51 }
52 
53 double TrackChoice::id() const {
54  return impl_->id;
55 }
56 
57 const std::string& TrackChoice::type() const {
58  return impl_->type;
59 }
60 
62  return impl_->fromAdaptation;
63 }
64 
66  return impl_->bandwidth;
67 }
68 
69 
71  js::TrackChoice ret;
72  ret.timestamp = impl_->timestamp;
73  ret.id = impl_->id;
74  ret.type = impl_->type;
75  ret.fromAdaptation = impl_->fromAdaptation;
76  ret.bandwidth = impl_->bandwidth;
77  return ret;
78 }
79 
80 
82  public:
83  const double timestamp{};
84  const std::string state{};
85  const double duration{};
86 
87  Impl() {}
88  Impl(js::StateChange&& internal)
89  : timestamp(std::move(internal.timestamp)),
90  state(std::move(internal.state)),
91  duration(std::move(internal.duration)) {}
92 };
93 
94 StateChange::StateChange() : impl_(new Impl) {}
95 StateChange::StateChange(js::StateChange&& internal) : impl_(new Impl{std::move(internal)}) {}
96 StateChange::StateChange(const StateChange&) = default;
99 
102 
103 double StateChange::timestamp() const {
104  return impl_->timestamp;
105 }
106 
107 const std::string& StateChange::state() const {
108  return impl_->state;
109 }
110 
111 double StateChange::duration() const {
112  return impl_->duration;
113 }
114 
115 
117  js::StateChange ret;
118  ret.timestamp = impl_->timestamp;
119  ret.state = impl_->state;
120  ret.duration = impl_->duration;
121  return ret;
122 }
123 
124 
125 class Stats::Impl {
126  public:
127  const double width{};
128  const double height{};
129  const double streamBandwidth{};
130  const double decodedFrames{};
131  const double droppedFrames{};
132  const double estimatedBandwidth{};
133  const double loadLatency{};
134  const double playTime{};
135  const double bufferingTime{};
136  const std::vector<shaka::TrackChoice> switchHistory{};
137  const std::vector<shaka::StateChange> stateHistory{};
138 
139  Impl() {}
140  Impl(js::Stats&& internal)
141  : width(std::move(internal.width)),
142  height(std::move(internal.height)),
143  streamBandwidth(std::move(internal.streamBandwidth)),
144  decodedFrames(std::move(internal.decodedFrames)),
145  droppedFrames(std::move(internal.droppedFrames)),
146  estimatedBandwidth(std::move(internal.estimatedBandwidth)),
147  loadLatency(std::move(internal.loadLatency)),
148  playTime(std::move(internal.playTime)),
149  bufferingTime(std::move(internal.bufferingTime)),
150  switchHistory(std::make_move_iterator(internal.switchHistory.begin()), std::make_move_iterator(internal.switchHistory.end())),
151  stateHistory(std::make_move_iterator(internal.stateHistory.begin()), std::make_move_iterator(internal.stateHistory.end())) {}
152 };
153 
154 Stats::Stats() : impl_(new Impl) {}
155 Stats::Stats(js::Stats&& internal) : impl_(new Impl{std::move(internal)}) {}
156 Stats::Stats(const Stats&) = default;
157 Stats::Stats(Stats&&) = default;
159 
160 Stats& Stats::operator=(const Stats&) = default;
161 Stats& Stats::operator=(Stats&&) = default;
162 
163 double Stats::width() const {
164  return impl_->width;
165 }
166 
167 double Stats::height() const {
168  return impl_->height;
169 }
170 
171 double Stats::stream_bandwidth() const {
172  return impl_->streamBandwidth;
173 }
174 
175 double Stats::decoded_frames() const {
176  return impl_->decodedFrames;
177 }
178 
179 double Stats::dropped_frames() const {
180  return impl_->droppedFrames;
181 }
182 
184  return impl_->estimatedBandwidth;
185 }
186 
187 double Stats::load_latency() const {
188  return impl_->loadLatency;
189 }
190 
191 double Stats::play_time() const {
192  return impl_->playTime;
193 }
194 
195 double Stats::buffering_time() const {
196  return impl_->bufferingTime;
197 }
198 
199 const std::vector<shaka::TrackChoice>& Stats::switch_history() const {
200  return impl_->switchHistory;
201 }
202 
203 const std::vector<shaka::StateChange>& Stats::state_history() const {
204  return impl_->stateHistory;
205 }
206 
207 
209  js::Stats ret;
210  ret.width = impl_->width;
211  ret.height = impl_->height;
212  ret.streamBandwidth = impl_->streamBandwidth;
213  ret.decodedFrames = impl_->decodedFrames;
214  ret.droppedFrames = impl_->droppedFrames;
215  ret.estimatedBandwidth = impl_->estimatedBandwidth;
216  ret.loadLatency = impl_->loadLatency;
217  ret.playTime = impl_->playTime;
218  ret.bufferingTime = impl_->bufferingTime;
219  for (const auto& item : impl_->switchHistory) {
220  ret.switchHistory.emplace_back(item.GetInternal());
221  }
222  for (const auto& item : impl_->stateHistory) {
223  ret.stateHistory.emplace_back(item.GetInternal());
224  }
225  return ret;
226 }
227 
228 
229 
230 } // namespace shaka
const shaka::optional< double > bandwidth
Definition: stats.cc:29
double stream_bandwidth() const
Definition: stats.cc:171
const bool fromAdaptation
Definition: stats.cc:28
double estimated_bandwidth() const
Definition: stats.cc:183
const std::string & type() const
Definition: stats.cc:57
const std::vector< shaka::StateChange > & state_history() const
Definition: stats.cc:203
double width() const
Definition: stats.cc:163
const std::vector< shaka::TrackChoice > & switch_history() const
Definition: stats.cc:199
js::StateChange GetInternal() const
Definition: stats.cc:116
Impl(js::StateChange &&internal)
Definition: stats.cc:88
double id() const
Definition: stats.cc:53
const std::string & state() const
Definition: stats.cc:107
int width
double load_latency() const
Definition: stats.cc:187
TrackChoice & operator=(const TrackChoice &)
double duration() const
Definition: stats.cc:111
Stats & operator=(const Stats &)
bool from_adaptation() const
Definition: stats.cc:61
StateChange & operator=(const StateChange &)
double timestamp() const
Definition: stats.cc:49
int height
Impl(js::TrackChoice &&internal)
Definition: stats.cc:32
js::TrackChoice GetInternal() const
Definition: stats.cc:70
double decoded_frames() const
Definition: stats.cc:175
const double timestamp
Definition: stats.cc:25
Impl(js::Stats &&internal)
Definition: stats.cc:140
const std::string type
Definition: stats.cc:27
js::Stats GetInternal() const
Definition: stats.cc:208
double play_time() const
Definition: stats.cc:191
double height() const
Definition: stats.cc:167
double buffering_time() const
Definition: stats.cc:195
const double id
Definition: stats.cc:26
double dropped_frames() const
Definition: stats.cc:179
double timestamp() const
Definition: stats.cc:103
shaka::optional< double > bandwidth() const
Definition: stats.cc:65