1 // Copyright 2014 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 #include "media/cast/logging/proto/proto_utils.h"
7 #include "base/logging.h"
9 #define TO_PROTO_ENUM(from_enum, to_enum) \
11 return media::cast::proto::to_enum
16 media::cast::proto::EventType
ToProtoEventType(CastLoggingEvent event
) {
18 TO_PROTO_ENUM(kUnknown
, UNKNOWN
);
19 TO_PROTO_ENUM(kRttMs
, RTT_MS
);
20 TO_PROTO_ENUM(kPacketLoss
, PACKET_LOSS
);
21 TO_PROTO_ENUM(kJitterMs
, JITTER_MS
);
22 TO_PROTO_ENUM(kVideoAckReceived
, VIDEO_ACK_RECEIVED
);
23 TO_PROTO_ENUM(kRembBitrate
, REMB_BITRATE
);
24 TO_PROTO_ENUM(kAudioAckSent
, AUDIO_ACK_SENT
);
25 TO_PROTO_ENUM(kVideoAckSent
, VIDEO_ACK_SENT
);
26 TO_PROTO_ENUM(kAudioFrameReceived
, AUDIO_FRAME_RECEIVED
);
27 TO_PROTO_ENUM(kAudioFrameCaptured
, AUDIO_FRAME_CAPTURED
);
28 TO_PROTO_ENUM(kAudioFrameEncoded
, AUDIO_FRAME_ENCODED
);
29 TO_PROTO_ENUM(kAudioPlayoutDelay
, AUDIO_PLAYOUT_DELAY
);
30 TO_PROTO_ENUM(kAudioFrameDecoded
, AUDIO_FRAME_DECODED
);
31 TO_PROTO_ENUM(kVideoFrameCaptured
, VIDEO_FRAME_CAPTURED
);
32 TO_PROTO_ENUM(kVideoFrameReceived
, VIEDO_FRAME_RECEIVED
);
33 TO_PROTO_ENUM(kVideoFrameSentToEncoder
, VIDEO_FRAME_SENT_TO_ENCODER
);
34 TO_PROTO_ENUM(kVideoFrameEncoded
, VIDEO_FRAME_ENCODED
);
35 TO_PROTO_ENUM(kVideoFrameDecoded
, VIDEO_FRAME_DECODED
);
36 TO_PROTO_ENUM(kVideoRenderDelay
, VIDEO_RENDER_DELAY
);
37 TO_PROTO_ENUM(kPacketSentToPacer
, PACKET_SENT_TO_PACER
);
38 TO_PROTO_ENUM(kPacketSentToNetwork
, PACKET_SENT_TO_NETWORK
);
39 TO_PROTO_ENUM(kPacketRetransmitted
, PACKET_RETRANSMITTED
);
40 TO_PROTO_ENUM(kAudioPacketReceived
, AUDIO_PACKET_RECEIVED
);
41 TO_PROTO_ENUM(kVideoPacketReceived
, VIDEO_PACKET_RECEIVED
);
42 TO_PROTO_ENUM(kDuplicatePacketReceived
, DUPLICATE_PACKET_RECEIVED
);
43 case kNumOfLoggingEvents
:
45 return media::cast::proto::UNKNOWN
;
48 return media::cast::proto::UNKNOWN
;