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

Unified Diff: tools/matlab/rtpAnalyze.m

Issue 1172533004: Update rtpAnalyze matlab tool to handle reordered packets (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/matlab/rtpAnalyze.m
diff --git a/tools/matlab/rtpAnalyze.m b/tools/matlab/rtpAnalyze.m
index 7ad45631b933cd2cc2bbb1dbee42324dccb58242..eb0cb8f586ffa879151fa18b44ae94ff59c295fc 100644
--- a/tools/matlab/rtpAnalyze.m
+++ b/tools/matlab/rtpAnalyze.m
@@ -65,9 +65,12 @@ if length(uPT) > 1
end
fprintf('\n');
fprintf('Packets: %i\n', length(SeqNo));
+SortSeqNo = sort(SeqNoUW);
fprintf('Missing sequence numbers: %i\n', ...
- length(find(diff(sort(SeqNoUW)) > 1)));
-fprintf('Reordered packets: %i\n', length(find(diff(sort(SeqNoUW)) < 1)));
+ length(find(diff(SortSeqNo) > 1)));
+fprintf('Duplicated packets: %i\n', length(find(diff(SortSeqNo) == 0)));
+reorderIx = findReorderedPackets(SeqNoUW);
+fprintf('Reordered packets: %i\n', length(reorderIx));
tsdiff = diff(TimeStampUW);
tsdiff = tsdiff(diff(SeqNoUW) == 1);
[utsdiff, ~, ixtsdiff] = unique(tsdiff);
@@ -117,8 +120,20 @@ fprintf('Received average bitrate: %i kbps\n', ...
%% Plots.
delay = ArrTime - SendTimeMs;
delay = delay - min(delay);
+delayOrdered = delay;
+delayOrdered(reorderIx) = nan; % Set reordered packets to NaN.
+delayReordered = delay(reorderIx); % Pick the reordered packets.
+sendTimeMsReordered = SendTimeMs(reorderIx);
+
+% Sort time arrays in packet send order.
+[~, sortix] = sort(SeqNoUW);
+SendTimeMs = SendTimeMs(sortix);
+Size = Size(sortix);
+delayOrdered = delayOrdered(sortix);
+
figure
-plot(SendTimeMs / 1000, delay);
+plot(SendTimeMs / 1000, delayOrdered, ...
+ sendTimeMsReordered / 1000, delayReordered, 'r.');
xlabel('Send time [s]');
ylabel('Relative transport delay [ms]');
title(sprintf('SSRC: %s', SSRC{1}));
@@ -130,6 +145,23 @@ xlabel('Send time [s]');
ylabel('Send bitrate [kbps]');
end
+%% Subfunctions.
+
+% findReorderedPackets returns the index to all packets that are considered
+% old compared with the largest seen sequence number. The input seqNo must
+% be unwrapped for this to work.
+function reorderIx = findReorderedPackets(seqNo)
+largestSeqNo = seqNo(1);
+reorderIx = [];
+for i = 2:length(seqNo)
+ if seqNo(i) < largestSeqNo
+ reorderIx = [reorderIx; i]; %#ok<AGROW>
+ else
+ largestSeqNo = seqNo(i);
+ end
+end
+end
+
%% Auto-generated subfunction.
function [SeqNo,TimeStamp,SendTime,Size,PT,M,SSRC] = ...
importfile(filename, startRow, endRow)
« 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