Index: webrtc/video/rtc_event_log_parser.h |
diff --git a/webrtc/video/rtc_event_log_parser.h b/webrtc/video/rtc_event_log_parser.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c46de41eaef45562ae7dcf6ca5bab793ef4073b |
--- /dev/null |
+++ b/webrtc/video/rtc_event_log_parser.h |
@@ -0,0 +1,82 @@ |
+/* |
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+#ifndef WEBRTC_VIDEO_RTC_EVENT_LOG_PARSER_H_ |
+#define WEBRTC_VIDEO_RTC_EVENT_LOG_PARSER_H_ |
+ |
+#include <string> |
+ |
+#include "webrtc/video_receive_stream.h" |
+#include "webrtc/video_send_stream.h" |
+ |
+// Files generated at build-time by the protobuf compiler. |
+#ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
+#include "external/webrtc/webrtc/video/rtc_event_log.pb.h" |
+#else |
+#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
|
+#endif |
+ |
+namespace webrtc { |
+ |
+enum class MediaType; |
+ |
+class RtcEventLogParser { |
+ public: |
+ // Converts a MediaType as stored by the protobuf to a |
+ // webrtc::MediaType as used by all other runtime functions. |
+ 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
|
+ |
+ // Reads an RtcEventLog file and returns true when reading was successful. |
+ // The result is stored in the given EventStream object. |
+ static bool ParseRtcEventLog(const std::string& file_name, |
+ rtclog::EventStream* result); |
+ |
+ // Reads the arrival timestamp (in microseconds) from a rtclog::Event. |
+ static int64_t GetTimestamp(const rtclog::Event& event); |
+ |
+ // Reads the event type of a rtclog::Event. |
+ static rtclog::Event_EventType GetEventType(const rtclog::Event& event); |
+ |
+ // Reads the header, direction, media type, header length and packet length |
+ // from an RTP event and stores it in the corresponding output parameter. |
+ // If some value is irrelevant, then that output parameter can be set to NULL. |
+ // NB: The header must have space for at least IP_PACKET_SIZE bytes. |
+ // 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.
|
+ static void GetRtpHeader(const rtclog::Event& event, |
+ bool* incoming, |
+ MediaType* media_type, |
+ uint8_t* header, |
+ size_t* header_length, |
+ size_t* total_length); |
+ |
+ // Reads packet, direction, media type and packet length from an RTCP event |
+ // and stores the results in the corresponding output parameters. |
+ // If some value is irrelevant, then that output parameter can be set to NULL. |
+ // NB: The packet must have space for at least IP_PACKET_SIZE bytes. |
+ // 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.
|
+ static void GetRtcpPacket(const rtclog::Event& event, |
+ bool* incoming, |
+ MediaType* media_type, |
+ uint8_t* packet, |
+ size_t* length); |
+ |
+ // Reads a config event to a (non NULL) VideoReceiveStream::Config struct. |
+ // Only the fields that are stored in the protobuf will be written. |
+ static void GetVideoReceiveConfig(const rtclog::Event& event, |
+ VideoReceiveStream::Config* config); |
+ |
+ // Reads a config event to a (non NULL) VideoSendStream::Config struct. |
+ // Only the fields that are stored in the protobuf will be written. |
+ static void GetVideoSendConfig(const rtclog::Event& event, |
+ VideoSendStream::Config* config); |
+}; |
+ |
+} // namespace webrtc |
+ |
+#endif // WEBRTC_VIDEO_RTC_EVENT_LOG_PARSER_H_ |