Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / media / cast / logging / logging_defines.h
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.
4
5 #ifndef MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
6 #define MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/time/time.h"
13
14 namespace media {
15 namespace cast {
16
17 static const uint32 kFrameIdUnknown = 0xFFFFFFFF;
18
19 typedef uint32 RtpTimestamp;
20
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
39 };
40
41 const char* CastLoggingToString(CastLoggingEvent event);
42
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
49 };
50
51 struct FrameEvent {
52   FrameEvent();
53   ~FrameEvent();
54
55   RtpTimestamp rtp_timestamp;
56   uint32 frame_id;
57
58   // Size of encoded frame. Only set for FRAME_ENCODED event.
59   size_t size;
60
61   // Time of event logged.
62   base::TimeTicks timestamp;
63
64   CastLoggingEvent type;
65
66   EventMediaType media_type;
67
68   // Only set for FRAME_PLAYOUT events.
69   // If this value is zero the frame is rendered on time.
70   // If this value is positive it means the frame is rendered late.
71   // If this value is negative it means the frame is rendered early.
72   base::TimeDelta delay_delta;
73
74   // Whether the frame is a key frame. Only set for video FRAME_ENCODED event.
75   bool key_frame;
76
77   // The requested target bitrate of the encoder at the time the frame is
78   // encoded. Only set for video FRAME_ENCODED event.
79   int target_bitrate;
80 };
81
82 struct PacketEvent {
83   PacketEvent();
84   ~PacketEvent();
85
86   RtpTimestamp rtp_timestamp;
87   uint32 frame_id;
88   uint16 max_packet_id;
89   uint16 packet_id;
90   size_t size;
91
92   // Time of event logged.
93   base::TimeTicks timestamp;
94   CastLoggingEvent type;
95   EventMediaType media_type;
96 };
97
98 }  // namespace cast
99 }  // namespace media
100
101 #endif  // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_