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 #ifndef MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_ | 5 #ifndef MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_ |
6 #define MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_ | 6 #define MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "media/base/video_frame.h" |
9 | 10 |
10 // This module provides a display of frame-level performance metrics, rendered | 11 // This module provides a display of frame-level performance metrics, rendered |
11 // in the lower-right corner of a VideoFrame. It looks like this: | 12 // in the lower-right corner of a VideoFrame. It looks like this: |
12 // | 13 // |
13 // +---------------------------------------------------------------------+ | 14 // +---------------------------------------------------------------------+ |
14 // | @@@@@@@@@@@@@@@@@@@@@@@ | | 15 // | @@@@@@@@@@@@@@@@@@@@@@@ | |
15 // | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | | 16 // | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | |
16 // | @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@ | | 17 // | @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@ | |
17 // | @@@@@@@@@@@@@ @@@@ | | 18 // | @@@@@@@@@@@@@ @@@@ | |
18 // | @@@@@@@@@@ @@@@ | | 19 // | @@@@@@@@@@ @@@@ | |
(...skipping 22 matching lines...) Expand all Loading... |
41 // playout delay is 400 ms and low-latency adjustment mode is not active. The | 42 // playout delay is 400 ms and low-latency adjustment mode is not active. The |
42 // target bitrate for this frame is 4000 kbps." If there were an exclamation | 43 // target bitrate for this frame is 4000 kbps." If there were an exclamation |
43 // mark (!) after the playout delay number instead of a period (.), it would | 44 // mark (!) after the playout delay number instead of a period (.), it would |
44 // indicate low-latency adjustment mode is active. See VideoSender for more | 45 // indicate low-latency adjustment mode is active. See VideoSender for more |
45 // details. | 46 // details. |
46 // | 47 // |
47 // Line 3: Contains the frame's duration (16.7 milliseconds), resolution, and | 48 // Line 3: Contains the frame's duration (16.7 milliseconds), resolution, and |
48 // media timestamp in minutes:seconds.hundredths format. | 49 // media timestamp in minutes:seconds.hundredths format. |
49 | 50 |
50 namespace media { | 51 namespace media { |
51 | |
52 class VideoFrame; | |
53 | |
54 namespace cast { | 52 namespace cast { |
55 | 53 |
56 // Renders an overlay of frame-level performance metrics in the lower-right | 54 // If the user has requested VideoFrames have a performance metrics overlay |
57 // corner of the |frame|, as described above. The verbose logging level for | 55 // rendered on them, this function copies the |source| frame and then renders an |
58 // video_frame_overlay.cc determines which lines, if any, are rendered: VLOG | 56 // overlay on the copy. Frame-level performance metrics will be rendered in the |
59 // level 1 renders the bottom line only, level 2 renders the bottom and middle | 57 // lower-right corner of the frame, as described in the module-level comments |
60 // lines, and level 3 renders all three lines. So, use the | 58 // above. |
61 // --vmodule=performance_metrics_overlay=3 command line argument to turn on | 59 // |
62 // rendering of the entire overlay. | 60 // The verbose logging level for video_frame_overlay.cc determines which lines, |
63 void MaybeRenderPerformanceMetricsOverlay(base::TimeDelta target_playout_delay, | 61 // if any, are rendered: no VLOG level does nothing, level 1 renders the bottom |
64 bool in_low_latency_mode, | 62 // line only, level 2 renders the bottom and middle lines, and level 3 renders |
65 int target_bitrate, | 63 // all three lines. So, use the --vmodule=performance_metrics_overlay=3 command |
66 int frames_ago, | 64 // line argument to turn on rendering of the entire overlay. |
67 double encoder_utilization, | 65 // |
68 double lossy_utilization, | 66 // Note: If |source| is an unsupported format, or no pixels need to be modified, |
69 VideoFrame* frame); | 67 // this function will just return |source|. |
| 68 scoped_refptr<VideoFrame> MaybeRenderPerformanceMetricsOverlay( |
| 69 base::TimeDelta target_playout_delay, |
| 70 bool in_low_latency_mode, |
| 71 int target_bitrate, |
| 72 int frames_ago, |
| 73 double encoder_utilization, |
| 74 double lossy_utilization, |
| 75 scoped_refptr<VideoFrame> source); |
70 | 76 |
71 } // namespace cast | 77 } // namespace cast |
72 } // namespace media | 78 } // namespace media |
73 | 79 |
74 #endif // MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_ | 80 #endif // MEDIA_CAST_SENDER_PERFORMANCE_METRICS_OVERLAY_H_ |
OLD | NEW |