Dequeue new input buffer once old on is queued

automerge: 63aa037

* commit '63aa037b036b4234b99f34506ae9b246c3651c0a':
  Dequeue new input buffer once old on is queued
This commit is contained in:
Lajos Molnar
2014-10-05 03:12:35 +00:00
committed by android-build-merger

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);