Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: webrtc/tools/py_event_log_analyzer/pb_parse.py

Issue 2727913004: Fixed tools/py_event_log_analyzer/pb_parse.py (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license 3 # Use of this source code is governed by a BSD-style license
4 # that can be found in the LICENSE file in the root of the source 4 # that can be found in the LICENSE file in the root of the source
5 # tree. An additional intellectual property rights grant can be found 5 # tree. An additional intellectual property rights grant can be found
6 # in the file PATENTS. All contributing project authors may 6 # in the file PATENTS. All contributing project authors may
7 # be found in the AUTHORS file in the root of the source tree. 7 # be found in the AUTHORS file in the root of the source tree.
8 8
9 """Parses protobuf RTC dumps.""" 9 """Parses protobuf RTC dumps."""
10 10
11 from __future__ import division 11 from __future__ import division
12 import struct 12 import struct
13 import pyproto.webrtc.call.rtc_event_log_pb2 as rtc_pb 13 import pyproto.webrtc.logging.rtc_event_log.rtc_event_log_pb2 as rtc_pb
14 14
15 15
16 class DataPoint(object): 16 class DataPoint(object):
17 """Simple container class for RTP events.""" 17 """Simple container class for RTP events."""
18 18
19 def __init__(self, rtp_header_str, packet_size, 19 def __init__(self, rtp_header_str, packet_size,
20 arrival_timestamp_us, incoming): 20 arrival_timestamp_us, incoming):
21 """Builds a data point by parsing an RTP header, size and arrival time. 21 """Builds a data point by parsing an RTP header, size and arrival time.
22 22
23 RTP header structure is defined in RFC 3550 section 5.1. 23 RTP header structure is defined in RFC 3550 section 5.1.
(...skipping 19 matching lines...) Expand all
43 """ 43 """
44 event_stream = rtc_pb.EventStream() 44 event_stream = rtc_pb.EventStream()
45 with open(file_path, "rb") as f: 45 with open(file_path, "rb") as f:
46 event_stream.ParseFromString(f.read()) 46 event_stream.ParseFromString(f.read())
47 47
48 return [DataPoint(event.rtp_packet.header, 48 return [DataPoint(event.rtp_packet.header,
49 event.rtp_packet.packet_length, 49 event.rtp_packet.packet_length,
50 event.timestamp_us, event.rtp_packet.incoming) 50 event.timestamp_us, event.rtp_packet.incoming)
51 for event in event_stream.stream 51 for event in event_stream.stream
52 if event.HasField("rtp_packet")] 52 if event.HasField("rtp_packet")]
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698