Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / cast / logging / logging_defines.h
blobdc295547252f7f8222d9ac2a551dc5773abdde3e
1 // Copyright 2013 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_LOGGING_LOGGING_DEFINES_H_
6 #define MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/time/time.h"
14 namespace media {
15 namespace cast {
17 static const uint32 kFrameIdUnknown = 0xFFFFFFFF;
19 typedef uint32 RtpTimestamp;
21 enum CastLoggingEvent {
22 UNKNOWN,
23 // Sender side frame events.
24 FRAME_CAPTURE_BEGIN,
25 FRAME_CAPTURE_END,
26 FRAME_ENCODED,
27 FRAME_ACK_RECEIVED,
28 // Receiver side frame events.
29 FRAME_ACK_SENT,
30 FRAME_DECODED,
31 FRAME_PLAYOUT,
32 // Sender side packet events.
33 PACKET_SENT_TO_NETWORK,
34 PACKET_RETRANSMITTED,
35 PACKET_RTX_REJECTED,
36 // Receiver side packet events.
37 PACKET_RECEIVED,
38 kNumOfLoggingEvents = PACKET_RECEIVED
41 const char* CastLoggingToString(CastLoggingEvent event);
43 // CastLoggingEvent are classified into one of three following types.
44 enum EventMediaType {
45 AUDIO_EVENT,
46 VIDEO_EVENT,
47 UNKNOWN_EVENT,
48 EVENT_MEDIA_TYPE_LAST = UNKNOWN_EVENT
51 struct FrameEvent {
52 FrameEvent();
53 ~FrameEvent();
55 RtpTimestamp rtp_timestamp;
56 uint32 frame_id;
58 // Resolution of the frame. Only set for video FRAME_CAPTURE_END events.
59 int width;
60 int height;
62 // Size of encoded frame in bytes. Only set for FRAME_ENCODED event.
63 size_t size;
65 // Time of event logged.
66 base::TimeTicks timestamp;
68 CastLoggingEvent type;
70 EventMediaType media_type;
72 // Only set for FRAME_PLAYOUT events.
73 // If this value is zero the frame is rendered on time.
74 // If this value is positive it means the frame is rendered late.
75 // If this value is negative it means the frame is rendered early.
76 base::TimeDelta delay_delta;
78 // Whether the frame is a key frame. Only set for video FRAME_ENCODED event.
79 bool key_frame;
81 // The requested target bitrate of the encoder at the time the frame is
82 // encoded. Only set for video FRAME_ENCODED event.
83 int target_bitrate;
85 // Encoding performance metrics. See media/cast/sender/sender_encoded_frame.h
86 // for a description of these values.
87 double encoder_cpu_utilization;
88 double idealized_bitrate_utilization;
91 struct PacketEvent {
92 PacketEvent();
93 ~PacketEvent();
95 RtpTimestamp rtp_timestamp;
96 uint32 frame_id;
97 uint16 max_packet_id;
98 uint16 packet_id;
99 size_t size;
101 // Time of event logged.
102 base::TimeTicks timestamp;
103 CastLoggingEvent type;
104 EventMediaType media_type;
107 } // namespace cast
108 } // namespace media
110 #endif // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_