OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
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_VIDEO_RTC_EVENT_LOG_PARSER_H_ | |
11 #define WEBRTC_VIDEO_RTC_EVENT_LOG_PARSER_H_ | |
12 | |
13 #include <string> | |
14 | |
15 #include "webrtc/video_receive_stream.h" | |
16 #include "webrtc/video_send_stream.h" | |
17 | |
18 // Files generated at build-time by the protobuf compiler. | |
19 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | |
20 #include "external/webrtc/webrtc/video/rtc_event_log.pb.h" | |
21 #else | |
22 #include "webrtc/video/rtc_event_log.pb.h" | |
ivoc
2015/08/25 15:25:55
I wonder if there is a way to hide the protobuf in
terelius
2015/09/23 11:41:17
I agree that it would be very nice to hide the pro
ivoc
2015/09/25 14:16:34
I think that it is possible to completely hide the
| |
23 #endif | |
24 | |
25 namespace webrtc { | |
26 | |
27 enum class MediaType; | |
28 | |
29 class RtcEventLogParser { | |
30 public: | |
31 // Converts a MediaType as stored by the protobuf to a | |
32 // webrtc::MediaType as used by all other runtime functions. | |
33 static MediaType GetRuntimeMediaType(rtclog::MediaType media_type); | |
ivoc
2015/08/25 15:25:55
Does this function need to be public? Might be bet
hlundin-webrtc
2015/08/28 10:37:16
Acknowledged.
terelius
2015/09/23 11:41:17
This function is used in the unit test. (In fact i
ivoc
2015/09/25 14:16:34
Okay, good point. I guess it's fine to leave it he
| |
34 | |
35 // Reads an RtcEventLog file and returns true when reading was successful. | |
36 // The result is stored in the given EventStream object. | |
37 static bool ParseRtcEventLog(const std::string& file_name, | |
38 rtclog::EventStream* result); | |
39 | |
40 // Reads the arrival timestamp (in microseconds) from a rtclog::Event. | |
41 static int64_t GetTimestamp(const rtclog::Event& event); | |
42 | |
43 // Reads the event type of a rtclog::Event. | |
44 static rtclog::Event_EventType GetEventType(const rtclog::Event& event); | |
45 | |
46 // Reads the header, direction, media type, header length and packet length | |
47 // from an RTP event and stores it in the corresponding output parameter. | |
48 // If some value is irrelevant, then that output parameter can be set to NULL. | |
49 // NB: The header must have space for at least IP_PACKET_SIZE bytes. | |
50 // Returns false if the stored header is larger than IP_PACKET_SIZE. | |
ivoc
2015/08/25 15:25:55
Since you changed the return type, the comments sh
terelius
2015/09/23 11:41:17
Done.
| |
51 static void GetRtpHeader(const rtclog::Event& event, | |
52 bool* incoming, | |
53 MediaType* media_type, | |
54 uint8_t* header, | |
55 size_t* header_length, | |
56 size_t* total_length); | |
57 | |
58 // Reads packet, direction, media type and packet length from an RTCP event | |
59 // and stores the results in the corresponding output parameters. | |
60 // If some value is irrelevant, then that output parameter can be set to NULL. | |
61 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. | |
62 // Returns false if the stored packet is larger than IP_PACKET_SIZE | |
ivoc
2015/08/25 15:25:55
Same here.
terelius
2015/09/23 11:41:17
Done.
| |
63 static void GetRtcpPacket(const rtclog::Event& event, | |
64 bool* incoming, | |
65 MediaType* media_type, | |
66 uint8_t* packet, | |
67 size_t* length); | |
68 | |
69 // Reads a config event to a (non NULL) VideoReceiveStream::Config struct. | |
70 // Only the fields that are stored in the protobuf will be written. | |
71 static void GetVideoReceiveConfig(const rtclog::Event& event, | |
72 VideoReceiveStream::Config* config); | |
73 | |
74 // Reads a config event to a (non NULL) VideoSendStream::Config struct. | |
75 // Only the fields that are stored in the protobuf will be written. | |
76 static void GetVideoSendConfig(const rtclog::Event& event, | |
77 VideoSendStream::Config* config); | |
78 }; | |
79 | |
80 } // namespace webrtc | |
81 | |
82 #endif // WEBRTC_VIDEO_RTC_EVENT_LOG_PARSER_H_ | |
OLD | NEW |