Merge "media: fix MediaCodecTest#testException" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-02-25 18:21:19 +00:00
committed by Android (Google) Code Review

View File

@@ -2531,7 +2531,7 @@ final public class MediaCodec {
int offset, int size, long presentationTimeUs, int flags) int offset, int size, long presentationTimeUs, int flags)
throws CryptoException { throws CryptoException {
synchronized(mBufferLock) { synchronized(mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
invalidateByteBuffer(mCachedInputBuffers, index); invalidateByteBuffer(mCachedInputBuffers, index);
@@ -2783,7 +2783,7 @@ final public class MediaCodec {
long presentationTimeUs, long presentationTimeUs,
int flags) throws CryptoException { int flags) throws CryptoException {
synchronized(mBufferLock) { synchronized(mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
invalidateByteBuffer(mCachedInputBuffers, index); invalidateByteBuffer(mCachedInputBuffers, index);
@@ -2818,7 +2818,7 @@ final public class MediaCodec {
*/ */
public final int dequeueInputBuffer(long timeoutUs) { public final int dequeueInputBuffer(long timeoutUs) {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
} }
@@ -3534,7 +3534,7 @@ final public class MediaCodec {
public final int dequeueOutputBuffer( public final int dequeueOutputBuffer(
@NonNull BufferInfo info, long timeoutUs) { @NonNull BufferInfo info, long timeoutUs) {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
} }
@@ -3916,7 +3916,7 @@ final public class MediaCodec {
@NonNull @NonNull
public ByteBuffer[] getInputBuffers() { public ByteBuffer[] getInputBuffers() {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
if (mCachedInputBuffers == null) { if (mCachedInputBuffers == null) {
@@ -3952,7 +3952,7 @@ final public class MediaCodec {
@NonNull @NonNull
public ByteBuffer[] getOutputBuffers() { public ByteBuffer[] getOutputBuffers() {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
if (mCachedOutputBuffers == null) { if (mCachedOutputBuffers == null) {
@@ -3984,7 +3984,7 @@ final public class MediaCodec {
@Nullable @Nullable
public ByteBuffer getInputBuffer(int index) { public ByteBuffer getInputBuffer(int index) {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
} }
@@ -4018,7 +4018,7 @@ final public class MediaCodec {
@Nullable @Nullable
public Image getInputImage(int index) { public Image getInputImage(int index) {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
} }
@@ -4052,7 +4052,7 @@ final public class MediaCodec {
@Nullable @Nullable
public ByteBuffer getOutputBuffer(int index) { public ByteBuffer getOutputBuffer(int index) {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
} }
@@ -4085,7 +4085,7 @@ final public class MediaCodec {
@Nullable @Nullable
public Image getOutputImage(int index) { public Image getOutputImage(int index) {
synchronized (mBufferLock) { synchronized (mBufferLock) {
if (mBufferMode != BUFFER_MODE_LEGACY) { if (mBufferMode == BUFFER_MODE_BLOCK) {
throw new IncompatibleWithBlockModelException(); throw new IncompatibleWithBlockModelException();
} }
} }