OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/cast/sender/performance_metrics_overlay.h" | 5 #include "media/cast/sender/performance_metrics_overlay.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 } // namespace | 215 } // namespace |
216 | 216 |
217 void MaybeRenderPerformanceMetricsOverlay(base::TimeDelta target_playout_delay, | 217 void MaybeRenderPerformanceMetricsOverlay(base::TimeDelta target_playout_delay, |
218 bool in_low_latency_mode, | 218 bool in_low_latency_mode, |
219 int target_bitrate, | 219 int target_bitrate, |
220 int frames_ago, | 220 int frames_ago, |
221 double deadline_utilization, | 221 double encoder_utilization, |
222 double lossy_utilization, | 222 double lossy_utilization, |
223 VideoFrame* frame) { | 223 VideoFrame* frame) { |
224 if (VideoFrame::PlaneHorizontalBitsPerPixel(frame->format(), kPlane) != 8) { | 224 if (VideoFrame::PlaneHorizontalBitsPerPixel(frame->format(), kPlane) != 8) { |
225 DLOG(WARNING) << "Cannot render overlay: Plane " << kPlane << " not 8bpp."; | 225 DLOG(WARNING) << "Cannot render overlay: Plane " << kPlane << " not 8bpp."; |
226 return; | 226 return; |
227 } | 227 } |
228 | 228 |
229 // Can't render to unmappable memory (DmaBuf, CVPixelBuffer). | 229 // Can't render to unmappable memory (DmaBuf, CVPixelBuffer). |
230 if (!frame->IsMappable()) { | 230 if (!frame->IsMappable()) { |
231 DVLOG(2) << "Cannot render overlay: frame uses unmappable memory."; | 231 DVLOG(2) << "Cannot render overlay: frame uses unmappable memory."; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 target_kbits), | 292 target_kbits), |
293 top, | 293 top, |
294 frame); | 294 frame); |
295 | 295 |
296 // Move up one line's worth of pixels. | 296 // Move up one line's worth of pixels. |
297 top -= line_height; | 297 top -= line_height; |
298 if (top < 0 || !VLOG_IS_ON(3)) | 298 if (top < 0 || !VLOG_IS_ON(3)) |
299 return; | 299 return; |
300 | 300 |
301 // Line 1: Recent utilization metrics. | 301 // Line 1: Recent utilization metrics. |
302 const int deadline_pct = | 302 const int encoder_pct = |
303 base::saturated_cast<int>(deadline_utilization * 100.0 + 0.5); | 303 base::saturated_cast<int>(encoder_utilization * 100.0 + 0.5); |
304 const int lossy_pct = | 304 const int lossy_pct = |
305 base::saturated_cast<int>(lossy_utilization * 100.0 + 0.5); | 305 base::saturated_cast<int>(lossy_utilization * 100.0 + 0.5); |
306 RenderLineOfText(base::StringPrintf("%d %3.1d%% %3.1d%%", | 306 RenderLineOfText(base::StringPrintf("%d %3.1d%% %3.1d%%", frames_ago, |
307 frames_ago, | 307 encoder_pct, lossy_pct), |
308 deadline_pct, | 308 top, frame); |
309 lossy_pct), | |
310 top, | |
311 frame); | |
312 } | 309 } |
313 | 310 |
314 } // namespace cast | 311 } // namespace cast |
315 } // namespace media | 312 } // namespace media |
OLD | NEW |