| OLD | NEW |
| 1 function rtpAnalyze( input_file ) | 1 function rtpAnalyze( input_file ) |
| 2 %RTP_ANALYZE Analyze RTP stream(s) from a txt file | 2 %RTP_ANALYZE Analyze RTP stream(s) from a txt file |
| 3 % The function takes the output from the command line tool rtp_analyze | 3 % The function takes the output from the command line tool rtp_analyze |
| 4 % and analyzes the stream(s) therein. First, process your rtpdump file | 4 % and analyzes the stream(s) therein. First, process your rtpdump file |
| 5 % through rtp_analyze (from command line): | 5 % through rtp_analyze (from command line): |
| 6 % $ out/Debug/rtp_analyze my_file.rtp my_file.txt | 6 % $ out/Debug/rtp_analyze my_file.rtp my_file.txt |
| 7 % Then load it with this function (in Matlab): | 7 % Then load it with this function (in Matlab): |
| 8 % >> rtpAnalyze('my_file.txt') | 8 % >> rtpAnalyze('my_file.txt') |
| 9 | 9 |
| 10 % Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 10 % Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 11 % | 11 % |
| 12 % Use of this source code is governed by a BSD-style license | 12 % Use of this source code is governed by a BSD-style license |
| 13 % that can be found in the LICENSE file in the root of the source | 13 % that can be found in the LICENSE file in the root of the source |
| 14 % tree. An additional intellectual property rights grant can be found | 14 % tree. An additional intellectual property rights grant can be found |
| 15 % in the file PATENTS. All contributing project authors may | 15 % in the file PATENTS. All contributing project authors may |
| 16 % be found in the AUTHORS file in the root of the source tree. | 16 % be found in the AUTHORS file in the root of the source tree. |
| 17 | 17 |
| 18 [SeqNo,TimeStamp,ArrTime,Size,PT,M,SSRC] = importfile(input_file); | 18 [SeqNo,TimeStamp,ArrTime,Size,PT,M,SSRC] = importfile(input_file); |
| 19 | 19 |
| 20 %% Filter out RTCP packets. |
| 21 % These appear as RTP packets having payload types 72 through 76. |
| 22 ix = not(ismember(PT, 72:76)); |
| 23 fprintf('Removing %i RTCP packets\n', length(SeqNo) - sum(ix)); |
| 24 SeqNo = SeqNo(ix); |
| 25 TimeStamp = TimeStamp(ix); |
| 26 ArrTime = ArrTime(ix); |
| 27 Size = Size(ix); |
| 28 PT = PT(ix); |
| 29 M = M(ix); |
| 30 SSRC = SSRC(ix); |
| 31 |
| 20 %% Find streams. | 32 %% Find streams. |
| 21 [uSSRC, ~, uix] = unique(SSRC); | 33 [uSSRC, ~, uix] = unique(SSRC); |
| 22 | 34 |
| 23 % If there are multiple streams, select one and purge the other | 35 % If there are multiple streams, select one and purge the other |
| 24 % streams from the data vectors. If there is only one stream, the | 36 % streams from the data vectors. If there is only one stream, the |
| 25 % vectors are good to use as they are. | 37 % vectors are good to use as they are. |
| 26 if length(uSSRC) > 1 | 38 if length(uSSRC) > 1 |
| 27 for i=1:length(uSSRC) | 39 for i=1:length(uSSRC) |
| 28 uPT = unique(PT(uix == i)); | 40 uPT = unique(PT(uix == i)); |
| 29 fprintf('%i: %s (%d packets, pt: %i', i, uSSRC{i}, ... | 41 fprintf('%i: %s (%d packets, pt: %i', i, uSSRC{i}, ... |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 %% Allocate imported array to column variable names | 242 %% Allocate imported array to column variable names |
| 231 SeqNo = dataArray{:, 1}; | 243 SeqNo = dataArray{:, 1}; |
| 232 TimeStamp = dataArray{:, 2}; | 244 TimeStamp = dataArray{:, 2}; |
| 233 SendTime = dataArray{:, 3}; | 245 SendTime = dataArray{:, 3}; |
| 234 Size = dataArray{:, 4}; | 246 Size = dataArray{:, 4}; |
| 235 PT = dataArray{:, 5}; | 247 PT = dataArray{:, 5}; |
| 236 M = dataArray{:, 6}; | 248 M = dataArray{:, 6}; |
| 237 SSRC = dataArray{:, 7}; | 249 SSRC = dataArray{:, 7}; |
| 238 end | 250 end |
| 239 | 251 |
| OLD | NEW |