Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER_H_ | 10 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER_H_ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 DELAY_BASED_BWE_UPDATE = 7, | 67 DELAY_BASED_BWE_UPDATE = 7, |
| 68 VIDEO_RECEIVER_CONFIG_EVENT = 8, | 68 VIDEO_RECEIVER_CONFIG_EVENT = 8, |
| 69 VIDEO_SENDER_CONFIG_EVENT = 9, | 69 VIDEO_SENDER_CONFIG_EVENT = 9, |
| 70 AUDIO_RECEIVER_CONFIG_EVENT = 10, | 70 AUDIO_RECEIVER_CONFIG_EVENT = 10, |
| 71 AUDIO_SENDER_CONFIG_EVENT = 11, | 71 AUDIO_SENDER_CONFIG_EVENT = 11, |
| 72 AUDIO_NETWORK_ADAPTATION_EVENT = 16, | 72 AUDIO_NETWORK_ADAPTATION_EVENT = 16, |
| 73 BWE_PROBE_CLUSTER_CREATED_EVENT = 17, | 73 BWE_PROBE_CLUSTER_CREATED_EVENT = 17, |
| 74 BWE_PROBE_RESULT_EVENT = 18 | 74 BWE_PROBE_RESULT_EVENT = 18 |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 enum class MediaType { ANY, AUDIO, VIDEO, DATA }; | |
| 78 | |
| 77 // Reads an RtcEventLog file and returns true if parsing was successful. | 79 // Reads an RtcEventLog file and returns true if parsing was successful. |
| 78 bool ParseFile(const std::string& file_name); | 80 bool ParseFile(const std::string& file_name); |
| 79 | 81 |
| 80 // Reads an RtcEventLog from a string and returns true if successful. | 82 // Reads an RtcEventLog from a string and returns true if successful. |
| 81 bool ParseString(const std::string& s); | 83 bool ParseString(const std::string& s); |
| 82 | 84 |
| 83 // Reads an RtcEventLog from an istream and returns true if successful. | 85 // Reads an RtcEventLog from an istream and returns true if successful. |
| 84 bool ParseStream(std::istream& stream); | 86 bool ParseStream(std::istream& stream); |
| 85 | 87 |
| 86 // Returns the number of events in an EventStream. | 88 // Returns the number of events in an EventStream. |
| 87 size_t GetNumberOfEvents() const; | 89 size_t GetNumberOfEvents() const; |
| 88 | 90 |
| 89 // Reads the arrival timestamp (in microseconds) from a rtclog::Event. | 91 // Reads the arrival timestamp (in microseconds) from a rtclog::Event. |
| 90 int64_t GetTimestamp(size_t index) const; | 92 int64_t GetTimestamp(size_t index) const; |
| 91 | 93 |
| 92 // Reads the event type of the rtclog::Event at |index|. | 94 // Reads the event type of the rtclog::Event at |index|. |
| 93 EventType GetEventType(size_t index) const; | 95 EventType GetEventType(size_t index) const; |
| 94 | 96 |
| 95 // Reads the header, direction, media type, header length and packet length | 97 // Reads the header, direction, header length and packet length from the RTP |
| 96 // from the RTP event at |index|, and stores the values in the corresponding | 98 // event at |index|, and stores the values in the corresponding output |
| 97 // output parameters. Each output parameter can be set to nullptr if that | 99 // parameters. Each output parameter can be set to nullptr if that value |
| 98 // value isn't needed. | 100 // isn't needed. |
| 99 // NB: The header must have space for at least IP_PACKET_SIZE bytes. | 101 // NB: The header must have space for at least IP_PACKET_SIZE bytes. |
| 100 void GetRtpHeader(size_t index, | 102 void GetRtpHeader(size_t index, |
| 101 PacketDirection* incoming, | 103 PacketDirection* incoming, |
| 102 MediaType* media_type, | |
| 103 uint8_t* header, | 104 uint8_t* header, |
| 104 size_t* header_length, | 105 size_t* header_length, |
| 105 size_t* total_length) const; | 106 size_t* total_length) const; |
| 106 | 107 |
| 107 // Reads packet, direction, media type and packet length from the RTCP event | 108 // Reads packet, direction and packet length from the RTCP event at |index|, |
| 108 // at |index|, and stores the values in the corresponding output parameters. | 109 // and stores the values in the corresponding output parameters. |
| 109 // Each output parameter can be set to nullptr if that value isn't needed. | 110 // Each output parameter can be set to nullptr if that value isn't needed. |
| 110 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. | 111 // NB: The packet must have space for at least IP_PACKET_SIZE bytes. |
| 111 void GetRtcpPacket(size_t index, | 112 void GetRtcpPacket(size_t index, |
| 112 PacketDirection* incoming, | 113 PacketDirection* incoming, |
| 113 MediaType* media_type, | |
| 114 uint8_t* packet, | 114 uint8_t* packet, |
| 115 size_t* length) const; | 115 size_t* length) const; |
| 116 | 116 |
| 117 // Reads a config event to a (non-NULL) StreamConfig struct. | 117 // Reads a config event to a (non-NULL) StreamConfig struct. |
| 118 // Only the fields that are stored in the protobuf will be written. | 118 // Only the fields that are stored in the protobuf will be written. |
| 119 void GetVideoReceiveConfig(const rtclog::Event& event, | |
|
terelius
2017/05/30 08:11:19
Could we make these helper functions private?
perkj_webrtc
2017/05/30 10:17:54
yes
| |
| 120 rtclog::StreamConfig* config) const; | |
| 119 void GetVideoReceiveConfig(size_t index, rtclog::StreamConfig* config) const; | 121 void GetVideoReceiveConfig(size_t index, rtclog::StreamConfig* config) const; |
| 120 | 122 |
| 121 // Reads a config event to a (non-NULL) StreamConfig struct. | 123 // Reads a config event to a (non-NULL) StreamConfig struct. |
| 122 // Only the fields that are stored in the protobuf will be written. | 124 // Only the fields that are stored in the protobuf will be written. |
| 125 void GetVideoSendConfig(const rtclog::Event& event, | |
| 126 rtclog::StreamConfig* config) const; | |
| 123 void GetVideoSendConfig(size_t index, rtclog::StreamConfig* config) const; | 127 void GetVideoSendConfig(size_t index, rtclog::StreamConfig* config) const; |
| 124 | 128 |
| 125 // Reads a config event to a (non-NULL) StreamConfig struct. | 129 // Reads a config event to a (non-NULL) StreamConfig struct. |
| 126 // Only the fields that are stored in the protobuf will be written. | 130 // Only the fields that are stored in the protobuf will be written. |
| 131 void GetAudioReceiveConfig(const rtclog::Event& event, | |
| 132 rtclog::StreamConfig* config) const; | |
| 127 void GetAudioReceiveConfig(size_t index, rtclog::StreamConfig* config) const; | 133 void GetAudioReceiveConfig(size_t index, rtclog::StreamConfig* config) const; |
| 128 | 134 |
| 129 // Reads a config event to a (non-NULL) StreamConfig struct. | 135 // Reads a config event to a (non-NULL) StreamConfig struct. |
| 130 // Only the fields that are stored in the protobuf will be written. | 136 // Only the fields that are stored in the protobuf will be written. |
| 137 void GetAudioSendConfig(const rtclog::Event& event, | |
| 138 rtclog::StreamConfig* config) const; | |
| 131 void GetAudioSendConfig(size_t index, rtclog::StreamConfig* config) const; | 139 void GetAudioSendConfig(size_t index, rtclog::StreamConfig* config) const; |
| 132 | 140 |
| 133 // Reads the SSRC from the audio playout event at |index|. The SSRC is stored | 141 // Reads the SSRC from the audio playout event at |index|. The SSRC is stored |
| 134 // in the output parameter ssrc. The output parameter can be set to nullptr | 142 // in the output parameter ssrc. The output parameter can be set to nullptr |
| 135 // and in that case the function only asserts that the event is well formed. | 143 // and in that case the function only asserts that the event is well formed. |
| 136 void GetAudioPlayout(size_t index, uint32_t* ssrc) const; | 144 void GetAudioPlayout(size_t index, uint32_t* ssrc) const; |
| 137 | 145 |
| 138 // Reads bitrate, fraction loss (as defined in RFC 1889) and total number of | 146 // Reads bitrate, fraction loss (as defined in RFC 1889) and total number of |
| 139 // expected packets from the loss based BWE event at |index| and stores the | 147 // expected packets from the loss based BWE event at |index| and stores the |
| 140 // values in | 148 // values in |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 151 // parameter can be set to nullptr if that | 159 // parameter can be set to nullptr if that |
| 152 // value isn't needed. | 160 // value isn't needed. |
| 153 BweDelayBasedUpdate GetDelayBasedBweUpdate(size_t index) const; | 161 BweDelayBasedUpdate GetDelayBasedBweUpdate(size_t index) const; |
| 154 | 162 |
| 155 // Reads a audio network adaptation event to a (non-NULL) | 163 // Reads a audio network adaptation event to a (non-NULL) |
| 156 // AudioEncoderRuntimeConfig struct. Only the fields that are | 164 // AudioEncoderRuntimeConfig struct. Only the fields that are |
| 157 // stored in the protobuf will be written. | 165 // stored in the protobuf will be written. |
| 158 void GetAudioNetworkAdaptation(size_t index, | 166 void GetAudioNetworkAdaptation(size_t index, |
| 159 AudioEncoderRuntimeConfig* config) const; | 167 AudioEncoderRuntimeConfig* config) const; |
| 160 | 168 |
| 161 ParsedRtcEventLog::BweProbeClusterCreatedEvent GetBweProbeClusterCreated( | 169 BweProbeClusterCreatedEvent GetBweProbeClusterCreated(size_t index) const; |
| 162 size_t index) const; | |
| 163 | 170 |
| 164 ParsedRtcEventLog::BweProbeResultEvent GetBweProbeResult(size_t index) const; | 171 BweProbeResultEvent GetBweProbeResult(size_t index) const; |
| 172 | |
| 173 MediaType GetMediaType(uint32_t ssrc, PacketDirection direction) const; | |
| 165 | 174 |
| 166 private: | 175 private: |
| 167 std::vector<rtclog::Event> events_; | 176 std::vector<rtclog::Event> events_; |
| 177 | |
| 178 struct Stream { | |
| 179 Stream(uint32_t ssrc, | |
| 180 MediaType media_type, | |
| 181 webrtc::PacketDirection direction) | |
| 182 : ssrc(ssrc), media_type(media_type), direction(direction) {} | |
| 183 uint32_t ssrc; | |
| 184 MediaType media_type; | |
| 185 webrtc::PacketDirection direction; | |
| 186 }; | |
| 187 | |
| 188 // All configured streams found in the event log. | |
| 189 std::vector<Stream> streams_; | |
| 168 }; | 190 }; |
| 169 | 191 |
| 170 } // namespace webrtc | 192 } // namespace webrtc |
| 171 | 193 |
| 172 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER_H_ | 194 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER_H_ |
| OLD | NEW |