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 // Render / playout delay. Only set for FRAME_PLAYOUT events. 69 base::TimeDelta delay_delta; 70 71 // Whether the frame is a key frame. Only set for video FRAME_ENCODED event. 72 bool key_frame; 73 74 // The requested target bitrate of the encoder at the time the frame is 75 // encoded. Only set for video FRAME_ENCODED event. 76 int target_bitrate; 77 }; 78 79 struct PacketEvent { 80 PacketEvent(); 81 ~PacketEvent(); 82 83 RtpTimestamp rtp_timestamp; 84 uint32 frame_id; 85 uint16 max_packet_id; 86 uint16 packet_id; 87 size_t size; 88 89 // Time of event logged. 90 base::TimeTicks timestamp; 91 CastLoggingEvent type; 92 EventMediaType media_type; 93 }; 94 95 } // namespace cast 96 } // namespace media 97 98 #endif // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ 99