OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
stefan-webrtc
2016/04/26 18:39:42
2016?
terelius
2016/04/27 14:35:27
Done. One could argue for either 2015 or 2016.
| |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 #ifndef WEBRTC_CALL_RTC_EVENT_LOG_PARSER_H_ | |
11 #define WEBRTC_CALL_RTC_EVENT_LOG_PARSER_H_ | |
12 | |
13 #include <string> | |
14 #include <vector> | |
15 | |
16 #include "webrtc/call/rtc_event_log.h" | |
17 #include "webrtc/video_receive_stream.h" | |
18 #include "webrtc/video_send_stream.h" | |
19 | |
20 // Files generated at build-time by the protobuf compiler. | |
21 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | |
22 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" | |
stefan-webrtc
2016/04/26 18:39:42
I've never seen this before?
terelius
2016/04/27 14:35:27
It's the same include as in the event log. The pro
| |
23 #else | |
24 #include "webrtc/call/rtc_event_log.pb.h" | |
25 #endif | |
26 | |
27 namespace webrtc { | |
28 | |
29 enum class MediaType; | |
30 | |
31 class ParsedRtcEventLog { | |
32 friend class RtcEventLogTestHelper; | |
33 | |
34 public: | |
35 enum EventType { | |
36 UNKNOWN_EVENT = 0, | |
37 LOG_START = 1, | |
38 LOG_END = 2, | |
39 RTP_EVENT = 3, | |
40 RTCP_EVENT = 4, | |
41 AUDIO_PLAYOUT_EVENT = 5, | |
42 BWE_PACKET_LOSS_EVENT = 6, | |
43 BWE_PACKET_DELAY_EVENT = 7, | |
44 VIDEO_RECEIVER_CONFIG_EVENT = 8, | |
45 VIDEO_SENDER_CONFIG_EVENT = 9, | |
46 AUDIO_RECEIVER_CONFIG_EVENT = 10, | |
47 AUDIO_SENDER_CONFIG_EVENT = 11 | |
48 }; | |
49 | |
50 // Reads an RtcEventLog file and returns true if parsing was successful. | |
51 bool ParseFile(const std::string& file_name); | |
52 | |
53 // Returns the number of events in an EventStream. | |
54 size_t GetNumberOfEvents() const; | |
55 | |
56 // Reads the arrival timestamp (in microseconds) from a rtclog::Event. | |
57 int64_t GetTimestamp(size_t index) const; | |
58 | |
59 // Reads the event type of the rtclog::Event at |index|. | |
60 EventType GetEventType(size_t index) const; | |
61 | |
62 // Reads the header, direction, media type, header length and packet length | |
63 // from the RTP event at |index|, and stores the values in the corresponding | |
64 // output parameters. The output parameters can be set to nullptr if those | |
65 // values aren't needed. | |
66 // NB: The header must have space for at least IP_PACKET_SIZE bytes. | |
67 void GetRtpHeader(size_t index, | |
68 PacketDirection* incoming, | |
69 MediaType* media_type, | |
70 uint8_t* header, | |
71 size_t* header_length, | |
72 size_t* total_length) const; | |
73 | |
74 // Reads packet, direction, media type and packet length from the RTCP event | |
75 // at |index|, and stores the values in the corresponding output parameters. | |
76 // The output parameters can be set to nullptr if those values aren't needed. | |
77 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. | |
78 void GetRtcpPacket(size_t index, | |
79 PacketDirection* incoming, | |
80 MediaType* media_type, | |
81 uint8_t* packet, | |
82 size_t* length) const; | |
83 | |
84 // Reads a config event to a (non-NULL) VideoReceiveStream::Config struct. | |
85 // Only the fields that are stored in the protobuf will be written. | |
86 void GetVideoReceiveConfig(size_t index, | |
87 VideoReceiveStream::Config* config) const; | |
88 | |
89 // Reads a config event to a (non-NULL) VideoSendStream::Config struct. | |
90 // Only the fields that are stored in the protobuf will be written. | |
91 void GetVideoSendConfig(size_t index, VideoSendStream::Config* config) const; | |
92 | |
93 // Reads the SSRC from the audio playout event at |index|. The SSRC is stored | |
94 // in the output parameter ssrc. The output parameter can be set to nullptr | |
95 // and in that case the function only asserts that the event is well formed. | |
96 void GetAudioPlayout(size_t index, uint32_t* ssrc) const; | |
97 | |
98 // Reads bitrate, fraction loss (as defined in RFC 1889) and total number of | |
99 // expected packets from the BWE event at |index| and stores the values in | |
100 // the corresponding output parameters. The output parameters can be set to | |
101 // nullptr if those values aren't needed. | |
102 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. | |
103 void GetBwePacketLossEvent(size_t index, | |
104 int32_t* bitrate, | |
105 uint8_t* fraction_loss, | |
106 int32_t* total_packets) const; | |
107 | |
108 private: | |
109 std::vector<rtclog::Event> stream_; | |
110 }; | |
111 | |
112 } // namespace webrtc | |
113 | |
114 #endif // WEBRTC_CALL_RTC_EVENT_LOG_PARSER_H_ | |
OLD | NEW |