Add buffer length metric to ABR playback test.
This metric is measured once every second. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=161527345
This commit is contained in:
parent
0b58c33632
commit
0621651476
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.testutil;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.view.Surface;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.testutil.Action.ClearVideoSurface;
|
||||
import com.google.android.exoplayer2.testutil.Action.Seek;
|
||||
@ -91,11 +92,18 @@ public final class ActionSchedule {
|
||||
* @return The builder, for convenience.
|
||||
*/
|
||||
public Builder apply(Action action) {
|
||||
ActionNode next = new ActionNode(action, currentDelayMs);
|
||||
previousNode.setNext(next);
|
||||
previousNode = next;
|
||||
currentDelayMs = 0;
|
||||
return this;
|
||||
return appendActionNode(new ActionNode(action, currentDelayMs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules an action to be executed repeatedly.
|
||||
*
|
||||
* @param action The action to schedule.
|
||||
* @param intervalMs The interval between each repetition in milliseconds.
|
||||
* @return The builder, for convenience.
|
||||
*/
|
||||
public Builder repeat(Action action, long intervalMs) {
|
||||
return appendActionNode(new ActionNode(action, currentDelayMs, intervalMs));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,6 +183,13 @@ public final class ActionSchedule {
|
||||
return new ActionSchedule(rootNode);
|
||||
}
|
||||
|
||||
private Builder appendActionNode(ActionNode actionNode) {
|
||||
previousNode.setNext(actionNode);
|
||||
previousNode = actionNode;
|
||||
currentDelayMs = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,6 +199,7 @@ public final class ActionSchedule {
|
||||
|
||||
private final Action action;
|
||||
private final long delayMs;
|
||||
private final long repeatIntervalMs;
|
||||
|
||||
private ActionNode next;
|
||||
|
||||
@ -197,8 +213,19 @@ public final class ActionSchedule {
|
||||
* @param delayMs The delay between the node being scheduled and the action being executed.
|
||||
*/
|
||||
public ActionNode(Action action, long delayMs) {
|
||||
this(action, delayMs, C.TIME_UNSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param action The wrapped action.
|
||||
* @param delayMs The delay between the node being scheduled and the action being executed.
|
||||
* @param repeatIntervalMs The interval between one execution and the next repetition. If set to
|
||||
* {@link C#TIME_UNSET}, the action is executed once only.
|
||||
*/
|
||||
public ActionNode(Action action, long delayMs, long repeatIntervalMs) {
|
||||
this.action = action;
|
||||
this.delayMs = delayMs;
|
||||
this.repeatIntervalMs = repeatIntervalMs;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,6 +261,9 @@ public final class ActionSchedule {
|
||||
if (next != null) {
|
||||
next.schedule(player, trackSelector, surface, mainHandler);
|
||||
}
|
||||
if (repeatIntervalMs != C.TIME_UNSET) {
|
||||
mainHandler.postDelayed(this, repeatIntervalMs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user