Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java

Issue 15822006: add error handling if MediaCodec fails to decode data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't report error on format change Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
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 13b9334afbac2915122e4563e55070e163f48404..399ae275295adbec7d05155894600675cdd0e2ab 100644
--- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
@@ -27,6 +27,10 @@ class MediaCodecBridge {
private static final String TAG = "MediaCodecBridge";
+ // Error code for MediaCodecBridge. Keep this value in sync with
+ // INFO_MEDIA_CODEC_ERROR in media_codec_bridge.h.
+ private static final int MEDIA_CODEC_ERROR = -1000;
+
private ByteBuffer[] mInputBuffers;
private ByteBuffer[] mOutputBuffers;
@@ -41,8 +45,8 @@ class MediaCodecBridge {
private final long mPresentationTimeMicroseconds;
private final int mNumBytes;
- private DequeueOutputResult(
- int index, int flags, int offset, long presentationTimeMicroseconds, int numBytes) {
+ private DequeueOutputResult(int index, int flags, int offset,
+ long presentationTimeMicroseconds, int numBytes) {
mIndex = index;
mFlags = flags;
mOffset = offset;
@@ -149,7 +153,12 @@ class MediaCodecBridge {
@CalledByNative
private DequeueOutputResult dequeueOutputBuffer(long timeoutUs) {
MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
- int index = mMediaCodec.dequeueOutputBuffer(info, timeoutUs);
+ int index = MEDIA_CODEC_ERROR;
+ try {
+ index = mMediaCodec.dequeueOutputBuffer(info, timeoutUs);
+ } catch(IllegalStateException e) {
+ Log.e(TAG, "Cannot dequeue output buffer " + e.toString());
+ }
return new DequeueOutputResult(
index, info.flags, info.offset, info.presentationTimeUs, info.size);
}
« no previous file with comments | « no previous file | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698