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_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 #ifdef ENABLE_RTC_EVENT_LOG |
| 21 // Files generated at build-time by the protobuf compiler. |
| 22 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
| 23 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" |
| 24 #else |
| 25 #include "webrtc/call/rtc_event_log.pb.h" |
| 26 #endif |
| 27 #endif // ENABLE_RTC_EVENT_LOG |
| 28 |
| 29 namespace webrtc { |
| 30 |
| 31 enum class MediaType; |
| 32 |
| 33 class ParsedRtcEventLog { |
| 34 friend class RtcEventLogTestHelper; |
| 35 |
| 36 public: |
| 37 enum EventType { |
| 38 UNKNOWN_EVENT = 0, |
| 39 LOG_START = 1, |
| 40 LOG_END = 2, |
| 41 RTP_EVENT = 3, |
| 42 RTCP_EVENT = 4, |
| 43 AUDIO_PLAYOUT_EVENT = 5, |
| 44 BWE_PACKET_LOSS_EVENT = 6, |
| 45 BWE_PACKET_DELAY_EVENT = 7, |
| 46 VIDEO_RECEIVER_CONFIG_EVENT = 8, |
| 47 VIDEO_SENDER_CONFIG_EVENT = 9, |
| 48 AUDIO_RECEIVER_CONFIG_EVENT = 10, |
| 49 AUDIO_SENDER_CONFIG_EVENT = 11 |
| 50 }; |
| 51 |
| 52 // Reads an RtcEventLog file and returns true if parsing was successful. |
| 53 bool ParseFile(const std::string& file_name); |
| 54 |
| 55 // Returns the number of events in an EventStream. |
| 56 size_t GetNumberOfEvents() const; |
| 57 |
| 58 // Reads the arrival timestamp (in microseconds) from a rtclog::Event. |
| 59 int64_t GetTimestamp(size_t i) const; |
| 60 |
| 61 // Reads the event type of the rtclog::Event at index i. |
| 62 EventType GetEventType(size_t i) const; |
| 63 |
| 64 // Reads the header, direction, media type, header length and packet length |
| 65 // from the RTP event at index i. The values are stored in the corresponding |
| 66 // output parameters. If some value is irrelevant, then that output parameter |
| 67 // can be set to NULL. |
| 68 // NB: The header must have space for at least IP_PACKET_SIZE bytes. |
| 69 void GetRtpHeader(size_t i, |
| 70 PacketDirection* incoming, |
| 71 MediaType* media_type, |
| 72 uint8_t* header, |
| 73 size_t* header_length, |
| 74 size_t* total_length) const; |
| 75 |
| 76 // Reads packet, direction, media type and packet length from the RTCP event |
| 77 // at index i. The values are stored in the corresponding output parameters. |
| 78 // If some value is irrelevant, then that output parameter can be set to NULL. |
| 79 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. |
| 80 void GetRtcpPacket(size_t i, |
| 81 PacketDirection* incoming, |
| 82 MediaType* media_type, |
| 83 uint8_t* packet, |
| 84 size_t* length) const; |
| 85 |
| 86 // Reads a config event to a (non-NULL) VideoReceiveStream::Config struct. |
| 87 // Only the fields that are stored in the protobuf will be written. |
| 88 void GetVideoReceiveConfig(size_t i, |
| 89 VideoReceiveStream::Config* config) const; |
| 90 |
| 91 // Reads a config event to a (non-NULL) VideoSendStream::Config struct. |
| 92 // Only the fields that are stored in the protobuf will be written. |
| 93 void GetVideoSendConfig(size_t i, VideoSendStream::Config* config) const; |
| 94 |
| 95 // Reads the SSRC from the audio playout event at index i. The SSRC is stored |
| 96 // in the output parameter ssrc. To only check that the event is well formed, |
| 97 // the output parameter can be set to NULL. |
| 98 void GetAudioPlayout(size_t i, uint32_t* ssrc) const; |
| 99 |
| 100 // Reads packet, direction, media type and packet length from the RTCP event |
| 101 // at index i. The values are stored in the corresponding output parameters. |
| 102 // If some value is irrelevant, then that output parameter can be set to NULL. |
| 103 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. |
| 104 void GetBwePacketLossEvent(size_t i, |
| 105 int32_t* bitrate, |
| 106 uint8_t* fraction_loss, |
| 107 int32_t* total_packets) const; |
| 108 |
| 109 private: |
| 110 #ifdef ENABLE_RTC_EVENT_LOG |
| 111 std::vector<rtclog::Event> stream_; |
| 112 #endif // ENABLE_RTC_EVENT_LOG |
| 113 }; |
| 114 |
| 115 } // namespace webrtc |
| 116 |
| 117 #endif // WEBRTC_CALL_RTC_EVENT_LOG_PARSER_H_ |
OLD | NEW |