[libvpx] Add flag to experiment with the impact of input/output buffers

PiperOrigin-RevId: 239122083
This commit is contained in:
olly 2019-03-19 04:24:15 +00:00 committed by Oliver Woodman
parent c81c14ae86
commit 8ffd7da890

View File

@ -98,12 +98,12 @@ public class LibvpxVideoRenderer extends BaseRenderer {
public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE; public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE;
/** The number of input buffers. */ /** The number of input buffers. */
private static final int NUM_INPUT_BUFFERS = 4; private final int numInputBuffers;
/** /**
* The number of output buffers. The renderer may limit the minimum possible value due to * The number of output buffers. The renderer may limit the minimum possible value due to
* requiring multiple output buffers to be dequeued at a time for it to make progress. * requiring multiple output buffers to be dequeued at a time for it to make progress.
*/ */
private static final int NUM_OUTPUT_BUFFERS = 4; private final int numOutputBuffers;
/** The default input buffer size. */ /** The default input buffer size. */
private static final int DEFAULT_INPUT_BUFFER_SIZE = 768 * 1024; // Value based on cs/SoftVpx.cpp. private static final int DEFAULT_INPUT_BUFFER_SIZE = 768 * 1024; // Value based on cs/SoftVpx.cpp.
@ -220,7 +220,9 @@ public class LibvpxVideoRenderer extends BaseRenderer {
playClearSamplesWithoutKeys, playClearSamplesWithoutKeys,
disableLoopFilter, disableLoopFilter,
/* enableRowMultiThreadMode= */ false, /* enableRowMultiThreadMode= */ false,
getRuntime().availableProcessors()); getRuntime().availableProcessors(),
/* numInputBuffers= */ 8,
/* numOutputBuffers= */ 8);
} }
/** /**
@ -241,6 +243,8 @@ public class LibvpxVideoRenderer extends BaseRenderer {
* @param disableLoopFilter Disable the libvpx in-loop smoothing filter. * @param disableLoopFilter Disable the libvpx in-loop smoothing filter.
* @param enableRowMultiThreadMode Whether row multi threading decoding is enabled. * @param enableRowMultiThreadMode Whether row multi threading decoding is enabled.
* @param threads Number of threads libvpx will use to decode. * @param threads Number of threads libvpx will use to decode.
* @param numInputBuffers Number of input buffers.
* @param numOutputBuffers Number of output buffers.
*/ */
public LibvpxVideoRenderer( public LibvpxVideoRenderer(
long allowedJoiningTimeMs, long allowedJoiningTimeMs,
@ -251,7 +255,9 @@ public class LibvpxVideoRenderer extends BaseRenderer {
boolean playClearSamplesWithoutKeys, boolean playClearSamplesWithoutKeys,
boolean disableLoopFilter, boolean disableLoopFilter,
boolean enableRowMultiThreadMode, boolean enableRowMultiThreadMode,
int threads) { int threads,
int numInputBuffers,
int numOutputBuffers) {
super(C.TRACK_TYPE_VIDEO); super(C.TRACK_TYPE_VIDEO);
this.disableLoopFilter = disableLoopFilter; this.disableLoopFilter = disableLoopFilter;
this.allowedJoiningTimeMs = allowedJoiningTimeMs; this.allowedJoiningTimeMs = allowedJoiningTimeMs;
@ -260,6 +266,8 @@ public class LibvpxVideoRenderer extends BaseRenderer {
this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys; this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
this.enableRowMultiThreadMode = enableRowMultiThreadMode; this.enableRowMultiThreadMode = enableRowMultiThreadMode;
this.threads = threads; this.threads = threads;
this.numInputBuffers = numInputBuffers;
this.numOutputBuffers = numOutputBuffers;
joiningDeadlineMs = C.TIME_UNSET; joiningDeadlineMs = C.TIME_UNSET;
clearReportedVideoSize(); clearReportedVideoSize();
formatHolder = new FormatHolder(); formatHolder = new FormatHolder();
@ -762,8 +770,8 @@ public class LibvpxVideoRenderer extends BaseRenderer {
format.maxInputSize != Format.NO_VALUE ? format.maxInputSize : DEFAULT_INPUT_BUFFER_SIZE; format.maxInputSize != Format.NO_VALUE ? format.maxInputSize : DEFAULT_INPUT_BUFFER_SIZE;
decoder = decoder =
new VpxDecoder( new VpxDecoder(
NUM_INPUT_BUFFERS, numInputBuffers,
NUM_OUTPUT_BUFFERS, numOutputBuffers,
initialInputBufferSize, initialInputBufferSize,
mediaCrypto, mediaCrypto,
disableLoopFilter, disableLoopFilter,