#ifndef MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
#define MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
#include <map>
#include <string>
#include <vector>
#include "base/time/time.h"
namespace media {
namespace cast {
static const uint32 kFrameIdUnknown = 0xFFFFFFFF;
typedef uint32 RtpTimestamp;
enum CastLoggingEvent {
kUnknown,
kRttMs,
kPacketLoss,
kJitterMs,
kVideoAckReceived,
kRembBitrate,
kAudioAckSent,
kVideoAckSent,
kAudioFrameReceived,
kAudioFrameCaptured,
kAudioFrameEncoded,
kAudioPlayoutDelay,
kAudioFrameDecoded,
kVideoFrameCaptured,
kVideoFrameReceived,
kVideoFrameSentToEncoder,
kVideoFrameEncoded,
kVideoFrameDecoded,
kVideoRenderDelay,
kAudioPacketSentToPacer,
kVideoPacketSentToPacer,
kAudioPacketSentToNetwork,
kVideoPacketSentToNetwork,
kAudioPacketRetransmitted,
kVideoPacketRetransmitted,
kAudioPacketReceived,
kVideoPacketReceived,
kDuplicateAudioPacketReceived,
kDuplicateVideoPacketReceived,
kNumOfLoggingEvents = kDuplicateVideoPacketReceived
};
const char* CastLoggingToString(CastLoggingEvent event);
enum EventMediaType { AUDIO_EVENT, VIDEO_EVENT, OTHER_EVENT };
EventMediaType GetEventMediaType(CastLoggingEvent event);
struct FrameEvent {
FrameEvent();
~FrameEvent();
RtpTimestamp rtp_timestamp;
uint32 frame_id;
size_t size;
base::TimeTicks timestamp;
CastLoggingEvent type;
base::TimeDelta delay_delta;
};
struct PacketEvent {
PacketEvent();
~PacketEvent();
RtpTimestamp rtp_timestamp;
uint32 frame_id;
uint16 max_packet_id;
uint16 packet_id;
size_t size;
base::TimeTicks timestamp;
CastLoggingEvent type;
};
struct GenericEvent {
GenericEvent();
~GenericEvent();
CastLoggingEvent type;
int value;
base::TimeTicks timestamp;
};
struct FrameLogStats {
FrameLogStats();
~FrameLogStats();
base::TimeTicks first_event_time;
base::TimeTicks last_event_time;
int event_counter;
size_t sum_size;
base::TimeDelta min_delay;
base::TimeDelta max_delay;
base::TimeDelta sum_delay;
};
struct PacketLogStats {
PacketLogStats();
~PacketLogStats();
base::TimeTicks first_event_time;
base::TimeTicks last_event_time;
int event_counter;
size_t sum_size;
};
struct GenericLogStats {
GenericLogStats();
~GenericLogStats();
base::TimeTicks first_event_time;
base::TimeTicks last_event_time;
int event_counter;
int sum;
uint64 sum_squared;
int min;
int max;
};
typedef std::map<CastLoggingEvent, FrameLogStats> FrameStatsMap;
typedef std::map<CastLoggingEvent, PacketLogStats> PacketStatsMap;
typedef std::map<CastLoggingEvent, GenericLogStats> GenericStatsMap;
}
}
#endif