Decrease number of Vpx input buffers

I think they're excessively sized also, but changing that
is a little more risky. And we should look at investigating
the input buffer size for all our decoder extensions,
rather than just this one.

Issue: #3120

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164234087
This commit is contained in:
olly 2017-08-04 00:57:05 -07:00 committed by Oliver Woodman
parent b664e92bb4
commit 40f3f1cb78
2 changed files with 20 additions and 5 deletions

View File

@ -30,7 +30,14 @@ import com.google.android.exoplayer2.util.MimeTypes;
*/
public final class FfmpegAudioRenderer extends SimpleDecoderAudioRenderer {
/**
* The number of input and output buffers.
*/
private static final int NUM_BUFFERS = 16;
/**
* The initial input buffer size. Input buffers are reallocated dynamically if this value is
* insufficient.
*/
private static final int INITIAL_INPUT_BUFFER_SIZE = 960 * 6;
private FfmpegDecoder decoder;

View File

@ -77,11 +77,18 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
public static final int MSG_SET_OUTPUT_BUFFER_RENDERER = C.MSG_CUSTOM_BASE;
/**
* The number of input buffers and 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.
* The number of input buffers.
*/
private static final int NUM_INPUT_BUFFERS = 8;
/**
* 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.
*/
private static final int NUM_OUTPUT_BUFFERS = 16;
/**
* The initial input buffer size. Input buffers are reallocated dynamically if this value is
* insufficient.
*/
private static final int NUM_BUFFERS = 16;
private static final int INITIAL_INPUT_BUFFER_SIZE = 768 * 1024; // Value based on cs/SoftVpx.cpp.
private final boolean scaleToFit;
@ -564,7 +571,8 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
try {
long codecInitializingTimestamp = SystemClock.elapsedRealtime();
TraceUtil.beginSection("createVpxDecoder");
decoder = new VpxDecoder(NUM_BUFFERS, NUM_BUFFERS, INITIAL_INPUT_BUFFER_SIZE, mediaCrypto);
decoder = new VpxDecoder(NUM_INPUT_BUFFERS, NUM_OUTPUT_BUFFERS, INITIAL_INPUT_BUFFER_SIZE,
mediaCrypto);
decoder.setOutputMode(outputMode);
TraceUtil.endSection();
long codecInitializedTimestamp = SystemClock.elapsedRealtime();