Skip to content

Commit

Permalink
Rebuffer rate as integer and not float. (ampproject#24150)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmajoulet committed Aug 23, 2019
1 parent 7ac6342 commit 38f3b0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions extensions/amp-story/1.0/media-performance-metrics-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,9 @@ export class MediaPerformanceMetricsService {
return;
}

const rebufferRate =
Math.round(
(metrics.rebufferTime / (metrics.rebufferTime + metrics.watchTime)) *
1000
) / 1000;
const rebufferRate = Math.round(
(metrics.rebufferTime / (metrics.rebufferTime + metrics.watchTime)) * 100
);

this.performanceService_.tickDelta('vjl', metrics.jointLatency);
this.performanceService_.tickDelta('vwt', metrics.watchTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ describes.fakeWin('media-performance-metrics-service', {}, env => {
service.stopMeasuring(video);

// playing: 600; waiting: 800
// 800 / (600 + 800) ~= 0.571
expect(tickStub).to.have.been.calledWithExactly('vrbr', 0.571);
// (800 / (600 + 800)) * 100 ~= 57
expect(tickStub).to.have.been.calledWithExactly('vrbr', 57);
});

it('should record mean time between rebuffers', () => {
Expand Down

0 comments on commit 38f3b0a

Please sign in to comment.