diff options
author | timav <timav@chromium.org> | 2016-01-19 16:00:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-20 00:01:27 +0000 |
commit | dd179e9972f9519611e3e8b99dd174707182bde9 (patch) | |
tree | d91c1ab44311c88c74e50ca2b3c07b0f4958060c /media/base | |
parent | c562c13d21a7006f973562af6b33bd784a396a71 (diff) | |
download | chromium_src-dd179e9972f9519611e3e8b99dd174707182bde9.zip chromium_src-dd179e9972f9519611e3e8b99dd174707182bde9.tar.gz chromium_src-dd179e9972f9519611e3e8b99dd174707182bde9.tar.bz2 |
Fix MediaCodec's ERROR_NO_KEY processing in AVDA
When MediaCodec.queueSecureInputBuffer() returns with NO_KEY
error, the input buffer is still owned by the client (i.e.
not by MediaCodec) and is filled with proper input data.
The correct behavior is to keep trying to queue it using
the same input buffer index and not dequeue new input buffers,
otherwise the input buffers pool depletes and might end,
in which case the MediaCodec would be blocked.
In addition, this CL assumes that OnKeyAdded() will be called
after we get the NO_KEY error and retries the queuing attempt
only after the OnKeyAdded() call.
BUG=577416
Review URL: https://codereview.chromium.org/1588773003
Cr-Commit-Position: refs/heads/master@{#370229}
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/android/java/src/org/chromium/media/MediaCodecBridge.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java index a6fe0a8..e62927b 100644 --- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java +++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java @@ -351,12 +351,12 @@ class MediaCodecBridge { keyId, iv, MediaCodec.CRYPTO_MODE_AES_CTR); mMediaCodec.queueSecureInputBuffer(index, offset, cryptoInfo, presentationTimeUs, 0); } catch (MediaCodec.CryptoException e) { - Log.e(TAG, "Failed to queue secure input buffer", e); if (e.getErrorCode() == MediaCodec.CryptoException.ERROR_NO_KEY) { - Log.e(TAG, "MediaCodec.CryptoException.ERROR_NO_KEY"); + Log.d(TAG, "Failed to queue secure input buffer: CryptoException.ERROR_NO_KEY"); return MEDIA_CODEC_NO_KEY; } - Log.e(TAG, "MediaCodec.CryptoException with error code " + e.getErrorCode()); + Log.e(TAG, "Failed to queue secure input buffer, CryptoException with error code " + + e.getErrorCode()); return MEDIA_CODEC_ERROR; } catch (IllegalStateException e) { Log.e(TAG, "Failed to queue secure input buffer, IllegalStateException " + e); |