From 60508f8621ae9188871c68a7317413a274071550 Mon Sep 17 00:00:00 2001 From: Henrik Lundin Date: Wed, 3 Jun 2015 09:38:23 +0200 Subject: [PATCH] Small changes to rtpAnalyze Matlab script These changes are in response to post-commit comments in https://webrtc-codereview.appspot.com/47339004/. BUG=webrtc:2692 R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50189004 Cr-Commit-Position: refs/heads/master@{#9358} --- tools/matlab/rtpAnalyze.m | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/matlab/rtpAnalyze.m b/tools/matlab/rtpAnalyze.m index 6da25f6a4d..7ad45631b9 100644 --- a/tools/matlab/rtpAnalyze.m +++ b/tools/matlab/rtpAnalyze.m @@ -15,13 +15,14 @@ function rtpAnalyze( input_file ) % in the file PATENTS. All contributing project authors may % be found in the AUTHORS file in the root of the source tree. - - [SeqNo,TimeStamp,ArrTime,Size,PT,M,SSRC] = importfile(input_file); -%% Find streams +%% Find streams. [uSSRC, ~, uix] = unique(SSRC); +% If there are multiple streams, select one and purge the other +% streams from the data vectors. If there is only one stream, the +% vectors are good to use as they are. if length(uSSRC) > 1 for i=1:length(uSSRC) uPT = unique(PT(uix == i)); @@ -36,7 +37,8 @@ if length(uSSRC) > 1 if sel < 1 || sel > length(uSSRC) error('Out of range'); end - ix = find(uix==sel); + ix = find(uix == sel); + % This is where the data vectors are trimmed. SeqNo = SeqNo(ix); TimeStamp = TimeStamp(ix); ArrTime = ArrTime(ix); @@ -46,11 +48,11 @@ if length(uSSRC) > 1 SSRC = SSRC(ix); end -%% Unwrap SeqNo and TimeStamp +%% Unwrap SeqNo and TimeStamp. SeqNoUW = maxUnwrap(SeqNo, 65535); TimeStampUW = maxUnwrap(TimeStamp, 4294967295); -%% Generate some stats for the stream +%% Generate some stats for the stream. fprintf('Statistics:\n'); fprintf('SSRC: %s\n', SSRC{1}); uPT = unique(PT); @@ -73,10 +75,10 @@ fprintf('Common packet sizes:\n'); for i = 1:length(utsdiff) fprintf(' %i samples (%i%%)\n', ... utsdiff(i), ... - round(100 * length(find(ixtsdiff==i))/length(ixtsdiff))); + round(100 * length(find(ixtsdiff == i))/length(ixtsdiff))); end -%% Trying to figure out sample rate +%% Trying to figure out sample rate. fs_est = (TimeStampUW(end) - TimeStampUW(1)) / (ArrTime(end) - ArrTime(1)); fs_vec = [8, 16, 32, 48]; fs = 0; @@ -108,10 +110,11 @@ fprintf('Clock drift: %.2f%%\n', ... fprintf('Sent average bitrate: %i kbps\n', ... round(sum(Size) * 8 / (SendTimeMs(end)-SendTimeMs(1)))); + fprintf('Received average bitrate: %i kbps\n', ... round(sum(Size) * 8 / (ArrTime(end)-ArrTime(1)))); -%% Plots +%% Plots. delay = ArrTime - SendTimeMs; delay = delay - min(delay); figure @@ -127,6 +130,7 @@ xlabel('Send time [s]'); ylabel('Send bitrate [kbps]'); end +%% Auto-generated subfunction. function [SeqNo,TimeStamp,SendTime,Size,PT,M,SSRC] = ... importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as column vectors.