|
| | ExtrapolateLocalTime (1870967878) |
| |
| while | ischar (line)% line ~ |
| |
| | plot (x, packetTime(:, 3) - firstTime - slope, 'b.') |
| |
| | plot (x, firstPacketTime(:, 2) - firstTime - slope, 'b.') |
| |
| end % Plot the frame complete time if | prod (size(completeTime)) > 0 x |
| |
| end | plot (x, completeTime(:, 3) - firstTime - slope, 'ks') |
| |
| end % Plot the time the decode starts if | prod (size(decodeTime)) > 0 x |
| |
| end | plot (x, decodeTime(:, 2) - firstTime - slope, 'r.') |
| |
| end % Plot the decode complete time if | prod (size(decodeCompleteTime)) > 0 x |
| |
| end | plot (x, decodeCompleteTime(:, 4) - firstTime - slope, 'g.') |
| |
| end if | prod (size(renderTime)) > 0 % Plot the wanted render time in ms x |
| |
| end | plot (x, renderTime(:, 2) - firstTime - slope, 'c-') |
| |
| end | plot (x, renderTime(:, 2) - firstTime - slope - renderTime(:, 3) - renderTime(:, 5), 'c--') |
| |
| end | plot (x, renderTime(:, 2) - firstTime - slope - renderTime(:, 3) - renderTime(:, 5), 'b-') |
| |
| end % | plot (x, 90 *x, 'r-') |
| |
| | xlabel ('RTP timestamp(in ms)') |
| |
| | ylabel ('Time(ms)') |
| |
| | legend ('Packet arrives', 'Frame complete', 'Decode', 'Decode complete', 'Time to render', 'Only jitter', 'Must decode') |
| |
| % | subplot (312) |
| |
| % % | plot (completeTs(completeIdx), completeTime(completeIdx, 3) - estimatedArrivalTime(arrivalIdx, 2)) |
| |
| % | plot (completeTs(completeIdx) - completeTs(completeIdx(1)), devFromAvgCompleteTime) |
| |
| % | plot (completeTime(:, 1) - completeTime(1, 1), completeTime(:, 4), 'r') |
| |
| % | plot (decodeCompleteTime(:, 1) - decodeCompleteTime(1, 1), decodeCompleteTime(:, 2), 'g') |
| |
| % | plot (decodeCompleteTime(:, 1) - decodeCompleteTime(1, 1), decodeCompleteTime(:, 3), 'k') |
| |
| % | xlabel ('RTP timestamp') |
| |
| % | legend ('Complete time - Estimated arrival time', 'Desired jitter buffer level', 'Actual decode time', 'Max decode time', 0) |
| |
| | plot (renderTime(:, 1) - firstTime, renderTime(:, 3), 'r-') |
| |
| | plot (renderTime(:, 1) - firstTime, renderTime(:, 4), 'b-') |
| |
| | plot (renderTime(:, 1) - firstTime, renderTime(:, 5), 'g-') |
| |
| | plot (renderTime(:, 1) - firstTime, renderTime(:, 6), 'k-') |
| |
| | plot (renderTime(:, 1) - firstTime, targetDelay, 'c-') |
| |
| | legend ('Render delay', 'Jitter delay', 'Decode delay', 'Extra delay', 'Min total delay') |
| |
|
| | function [t, TS] |
| |
| % | DEBUG |
| |
| | __pad0__ |
| |
| | __pad1__ |
| |
| | __pad2__ |
| |
| | __pad3__ |
| |
| Frame | decoded |
| |
| | __pad4__ |
| |
| Received complete frame timestamp frame type frame size at | time |
| |
| | __pad5__ |
| |
| end | line = fgetl(fid) |
| |
| | estimatedArrivalTime = [] |
| |
| | packetTime = [] |
| |
| | firstPacketTime = [] |
| |
| | decodeTime = [] |
| |
| | decodeCompleteTime = [] |
| |
| | renderTime = [] |
| |
| | completeTime = [] |
| |
| | continue |
| |
| end % Parse the trace line | header [tempres, count] = sscanf(line, 'DEBUG ; (%u:%u:%u:%u |%*lu)%13c:') |
| |
| if count< 5 line=fgetl(fid);continue;end hr=tempres(1);mn=tempres(2);sec=tempres(3);ms=tempres(4);timeInMs=hr *60 *60 *1000+mn *60 *1000+sec *1000+ms;label=tempres(5:end);I=find(label ~=32);label=label(I(1):end);% remove white spaces if ~strncmp(char(label), 'VIDEO', 5) &~strncmp(char(label), 'VIDEO CODING', 12) line=fgetl(fid);continue;end message=line(72:end);% Parse message [p, count]=sscanf(message, 'ExtrapolateLocalTime(% lu)=% lu ms');if count==2 estimatedArrivalTime=[estimatedArrivalTime;p'];line=fgetl(fid);continue;end [p, count]=sscanf(message, 'Packet seqNo % u of frame % lu at % lu');if count==3 packetTime=[packetTime;p'];line=fgetl(fid);continue;end [p, count]=sscanf(message, 'First packet of frame % lu at % lu');if count==2 firstPacketTime=[firstPacketTime;p'];line=fgetl(fid);continue;end [p, count]=sscanf(message, 'Decoding timestamp % lu at % lu');if count==2 decodeTime=[decodeTime;p'];line=fgetl(fid);continue;end [p, count]=sscanf(message, 'Render frame % lu at % lu. Render delay % lu, required delay % lu, max decode time % lu, min total delay % lu');if count==6 renderTime=[renderTime;p'];line=fgetl(fid);continue;end [p, count]=sscanf(message, 'Frame decoded:timeStamp=% lu decTime=% d maxDecTime=% lu, at % lu');if count==4 decodeCompleteTime=[decodeCompleteTime;p'];line=fgetl(fid);continue;end [p, count]=sscanf(message, 'Received complete frame timestamp % lu frame type % u frame size % *u at time % lu, jitter estimate was % lu');if count==4 completeTime=[completeTime;p'];line=fgetl(fid);continue;end line=fgetl(fid);endfclose(fid);t=completeTime(:, 3);TS=completeTime(:, 1);figure;subplot(211);hold on;slope=0;if sum(size(packetTime)) > % Plot the time when each packet arrives | firstTimeStamp = packetTime(1,2) |
| |
| | x = (packetTime(:,2) - firstTimeStamp)/90 |
| |
| if flat | slope = x |
| |
| end | firstTime = packetTime(1,3) |
| |
| % hold | on |
| |
| % | completeTs = completeTime(:, 1) |
| |
| % | arrivalTs = estimatedArrivalTime(:, 1) |
| |
| | % [c, completeIdx, arrivalIdx] = intersect(completeTs, arrivalTs) |
| |
| % | timeUntilComplete = completeTime(completeIdx, 3) - estimatedArrivalTime(arrivalIdx, 2) |
| |
| % | devFromAvgCompleteTime = timeUntilComplete - mean(timeUntilComplete) |
| |
| | targetDelay = max(renderTime(:, 3) + renderTime(:, 4) + renderTime(:, 5), renderTime(:, 6)) |
| |