Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / cast / sender / performance_metrics_overlay.h
blob3befda456b7ebe55572dd7b859c8b86bd8e3aa53
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_
6 #define MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_
8 // This module provides a display of frame-level performance metrics, rendered
9 // in the lower-right corner of a VideoFrame. It looks like this:
11 // +----------------------------------------------------------------+
12 // | @@@@@@@@@@@@@@@@@@@@@@@ |
13 // | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
14 // | @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@ |
15 // | @@@@@@@@@@@@@ @@@@ |
16 // | @@@@@@@@@@ @@@@ |
17 // | @@@@@ @@@ @@@ @@@@ |
18 // | @@@ @ @@@ @@@@ @@@@ |
19 // | @@@@ @@@@ @@@@ |
20 // | @@@@ @@@ @@@ |
21 // | @@@@ @@ @@@ |
22 // | @@@@@ @@@ @@@ @@@ |
23 // | @@@@@ @@@@@ @@@@ @@@@ |
24 // | @@@@@ @@@@@@@@@@@@@ @@@@ |
25 // | @@@@@@ @@@@ 1 45% 75% |
26 // | @@@@@@@@ @@@@@@ 22 16.7 4000 |
27 // | @@@@@@@@@@@@@@@@ 1280x720 0:15.12 |
28 // +----------------------------------------------------------------+
30 // Line 1: Reads as, "1 frame ago, the encoder deadline utilization for the
31 // frame was 45% and the lossy utilization was 75%." Encoder deadline
32 // utilization is in terms the amount of real-world time it took to encode the
33 // frame, divided by the maximum amount of time allowed. Lossy utilization is
34 // the amount of "complexity" in the frame's content versus the target encoded
35 // byte size, where a value over 100% means the frame's content is too complex
36 // to encode within the target number of bytes.
38 // Line 2: Reads as, "Capture of this frame took 22 ms. The expected duration
39 // of this frame is 16.7 ms. The target bitrate for this frame is 4000 kbps."
41 // Line 3: Contains the frame's resolution and media timestamp in
42 // minutes:seconds.hundredths format.
44 namespace media {
46 class VideoFrame;
48 namespace cast {
50 // Renders an overlay of frame-level performance metrics in the lower-right
51 // corner of the |frame|, as described above. The verbose logging level for
52 // video_frame_overlay.cc determines which lines, if any, are rendered: VLOG
53 // level 1 renders the bottom line only, level 2 renders the bottom and middle
54 // lines, and level 3 renders all three lines. So, use the
55 // --vmodule=performance_metrics_overlay=3 command line argument to turn on
56 // rendering of the entire overlay.
57 void MaybeRenderPerformanceMetricsOverlay(int target_bitrate,
58 int frames_ago,
59 double deadline_utilization,
60 double lossy_utilization,
61 VideoFrame* frame);
63 } // namespace cast
64 } // namespace media
66 #endif // MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_