From 749dafad09d85f2aaf6902a7ff16b4087e3bc4c7 Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Fri, 11 Jul 2014 16:17:14 -0700 Subject: MediaCodec: change onError cb to return CodecException Bug: 11990118 Change-Id: I3278aecb20df88c42fa2709a66e6166eb3cbe56f --- include/media/stagefright/MediaCodec.h | 2 +- media/libstagefright/MediaCodec.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index 046496c..a0ff997 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -279,7 +279,7 @@ private: void onInputBufferAvailable(); void onOutputBufferAvailable(); - void onError(int32_t actionCode, status_t err); + void onError(status_t err, int32_t actionCode, const char *detail = NULL); void onOutputFormatChanged(); status_t onSetParameters(const sp ¶ms); diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index f286659..24fd7ad 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -664,7 +664,7 @@ void MediaCodec::onMessageReceived(const sp &msg) { cancelPendingDequeueOperations(); if (mFlags & kFlagIsAsync) { - onError(0, omxError); + onError(omxError, 0); } setState(UNINITIALIZED); break; @@ -678,7 +678,7 @@ void MediaCodec::onMessageReceived(const sp &msg) { postActivityNotificationIfPossible(); if (mFlags & kFlagIsAsync) { - onError(0, omxError); + onError(omxError, 0); } setState(UNINITIALIZED); break; @@ -1916,12 +1916,16 @@ void MediaCodec::onOutputBufferAvailable() { } } -void MediaCodec::onError(int32_t actionCode, status_t err) { +void MediaCodec::onError(status_t err, int32_t actionCode, const char *detail) { if (mCallback != NULL) { sp msg = mCallback->dup(); msg->setInt32("callbackID", CB_ERROR); - msg->setInt32("actionCode", actionCode); msg->setInt32("err", err); + msg->setInt32("actionCode", actionCode); + + if (detail != NULL) { + msg->setString("detail", detail); + } msg->post(); } -- cgit v1.1