Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Side by Side Diff: webrtc/call/rtc_event_log_parser.h

Issue 1768773002: New parser for event log. Manually parse the outermost EventStream (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Move parser to its own build target. Fix comments from Henrik. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
ivoc 2016/04/01 08:27:59 Should be 2016 I guess?
terelius 2016/04/19 17:01:45 I created the file in 2015 when I started on the p
ivoc 2016/04/25 08:08:12 Ok, I'll leave it up to you :)
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"
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 {
ivoc 2016/04/01 08:27:59 Would it be possible to reuse the enum from the ge
terelius 2016/04/19 17:01:45 It is non-trivial. The enum is actually named Even
ivoc 2016/04/25 08:08:12 Acknowledged.
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);
ivoc 2016/04/01 08:27:59 I guess it doesn't make a big difference either wa
terelius 2016/04/19 17:01:45 Yeah, I though about that. I don't have any strong
ivoc 2016/04/25 08:08:12 Ok, sounds reasonable.
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 i) const;
ivoc 2016/04/01 08:27:59 I would prefer a more descriptive name instead of
terelius 2016/04/19 17:01:45 Done.
58
59 // Reads the event type of the rtclog::Event at index i.
60 EventType GetEventType(size_t i) const;
61
62 // Reads the header, direction, media type, header length and packet length
63 // from the RTP event at index i. The values are stored in the corresponding
64 // output parameters. If some value is irrelevant, then that output parameter
ivoc 2016/04/01 08:27:59 I think this could be rephrased a bit more clearly
terelius 2016/04/19 17:01:45 Done.
65 // can be set to NULL.
66 // NB: The header must have space for at least IP_PACKET_SIZE bytes.
67 void GetRtpHeader(size_t i,
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 i. The values are stored in the corresponding output parameters.
76 // If some value is irrelevant, then that output parameter can be set to NULL.
77 // NB: The packet must have space for at least IP_PACKET_SIZE bytes.
78 void GetRtcpPacket(size_t i,
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 i,
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 i, VideoSendStream::Config* config) const;
92
93 // Reads the SSRC from the audio playout event at index i. The SSRC is stored
94 // in the output parameter ssrc. To only check that the event is well formed,
95 // the output parameter can be set to NULL.
96 void GetAudioPlayout(size_t i, uint32_t* ssrc) const;
97
98 // Reads packet, direction, media type and packet length from the RTCP event
99 // at index i. The values are stored in the corresponding output parameters.
100 // If some value is irrelevant, then that output parameter can be set to NULL.
101 // NB: The packet must have space for at least IP_PACKET_SIZE bytes.
102 void GetBwePacketLossEvent(size_t i,
103 int32_t* bitrate,
104 uint8_t* fraction_loss,
105 int32_t* total_packets) const;
106
107 private:
108 std::vector<rtclog::Event> stream_;
109 };
110
111 } // namespace webrtc
112
113 #endif // WEBRTC_CALL_RTC_EVENT_LOG_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698