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}
This commit is contained in:
Henrik Lundin 2015-06-03 09:38:23 +02:00
parent 6b990744d9
commit 60508f8621

View File

@ -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.