Dequeue new input buffer once old on is queued

Bug: 17630446
Change-Id: I9ce19849f85eba4c419e0dab8ea03a0675526366
This commit is contained in:
Lajos Molnar
2014-09-24 14:06:04 -07:00
parent 138160ddea
commit 63aa037b03

View File

@@ -656,12 +656,20 @@ public class MediaDrmAPITest extends Activity {
// Log.i(TAG,"Sending " + sampleSize + " bytes, numSubSamples=" + numSubSamples);
codec.queueSecureInputBuffer(index, 0 /* offset */, info,
0 /* sampleTime */, 0 /* flags */);
Log.v(TAG, "queued index " + index);
if (expectNoKey) {
Log.e(TAG, "MediaCrypto failed to throw ERROR_NO_KEY!");
mTestFailed = true;
return;
}
Log.i(TAG, "waiting for buffer...");
while ((index = codec.dequeueInputBuffer(0 /* timeoutUs */)) < 0) {
sleep(10);
}
Log.i(TAG, "Got index " + index);
} catch (CryptoException e) {
Log.v(TAG, "queue failed for index " + index);
// Log.i(TAG,"Checking " + sampleSize + " bytes");
if (e.getErrorCode() == CryptoException.ERROR_NO_KEY) {
@@ -809,11 +817,19 @@ public class MediaDrmAPITest extends Activity {
info.set(1, clearSizes, encryptedSizes, null, null, MediaCodec.CRYPTO_MODE_UNENCRYPTED);
codec.queueSecureInputBuffer(index, 0 /* offset */, info,
0 /* sampleTime */, 0 /* flags */);
Log.v(TAG, "queued index " + index);
} else {
codec.queueInputBuffer(index, 0 /* offset */, tv.mClearBuf.length,
0 /* sampleTime */, 0 /* flags */);
Log.v(TAG, "queued index " + index);
}
Log.i(TAG, "waiting for buffer...");
while ((index = codec.dequeueInputBuffer(0 /* timeoutUs */)) < 0) {
sleep(10);
}
Log.i(TAG, "Got index " + index);
} catch (CryptoException e) {
Log.v(TAG, "queue failed for index " + index);
ByteBuffer refBuffer = ByteBuffer.allocate(tv.mClearBuf.length);
refBuffer.put(tv.mClearBuf, 0, tv.mClearBuf.length);