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" |
| 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); |
| 34 |
| 35 // Converts an RtcpMode as stored by the protobuf to a |
| 36 // newapi::RtcpMode as used in the VideoReceiveStream::Config. |
| 37 static newapi::RtcpMode GetRuntimeRtcpMode( |
| 38 rtclog::VideoReceiveConfig::RtcpMode rtcp_mode); |
| 39 |
| 40 // Reads an RtcEventLog file and returns true when reading was successful. |
| 41 // The result is stored in the given EventStream object. |
| 42 static bool ParseRtcEventLog(const std::string& file_name, |
| 43 rtclog::EventStream* result); |
| 44 |
| 45 // Returns the number of events in an EventStream. |
| 46 static int GetNumberOfEvents(const rtclog::EventStream& stream); |
| 47 |
| 48 // Returns a pointer to a specific event in the EventStream. |
| 49 static const rtclog::Event* GetEvent(const rtclog::EventStream& stream, |
| 50 int index); |
| 51 |
| 52 // Reads the arrival timestamp (in microseconds) from a rtclog::Event. |
| 53 static int64_t GetTimestamp(const rtclog::Event& event); |
| 54 |
| 55 // Reads the event type of a rtclog::Event. |
| 56 static rtclog::Event_EventType GetEventType(const rtclog::Event& event); |
| 57 |
| 58 // Reads the header, direction, media type, header length and packet length |
| 59 // from an RTP event and stores it in the corresponding output parameter. |
| 60 // If some value is irrelevant, then that output parameter can be set to NULL. |
| 61 // NB: The header must have space for at least IP_PACKET_SIZE bytes. |
| 62 static void GetRtpHeader(const rtclog::Event& event, |
| 63 bool* incoming, |
| 64 MediaType* media_type, |
| 65 uint8_t* header, |
| 66 size_t* header_length, |
| 67 size_t* total_length); |
| 68 |
| 69 // Reads packet, direction, media type and packet length from an RTCP event |
| 70 // and stores the results in the corresponding output parameters. |
| 71 // If some value is irrelevant, then that output parameter can be set to NULL. |
| 72 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. |
| 73 static void GetRtcpPacket(const rtclog::Event& event, |
| 74 bool* incoming, |
| 75 MediaType* media_type, |
| 76 uint8_t* packet, |
| 77 size_t* length); |
| 78 |
| 79 // Reads a config event to a (non NULL) VideoReceiveStream::Config struct. |
| 80 // Only the fields that are stored in the protobuf will be written. |
| 81 static void GetVideoReceiveConfig(const rtclog::Event& event, |
| 82 VideoReceiveStream::Config* config); |
| 83 |
| 84 // Reads a config event to a (non NULL) VideoSendStream::Config struct. |
| 85 // Only the fields that are stored in the protobuf will be written. |
| 86 static void GetVideoSendConfig(const rtclog::Event& event, |
| 87 VideoSendStream::Config* config); |
| 88 }; |
| 89 |
| 90 } // namespace webrtc |
| 91 |
| 92 #endif // WEBRTC_VIDEO_RTC_EVENT_LOG_PARSER_H_ |
OLD | NEW |