Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d0d3f9f authored by Arun Johnson's avatar Arun Johnson Committed by Gerrit Code Review
Browse files

Merge "Improve error reporting in MediaCodec"

parents 0812bf0e dc1e59e8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -3009,8 +3009,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    CHECK(msg->findInt32("err", &err));
                    CHECK(msg->findInt32("actionCode", &actionCode));

                    ALOGE("Codec reported err %#x, actionCode %d, while in state %d/%s",
                            err, actionCode, mState, stateString(mState).c_str());
                    ALOGE("Codec reported err %#x/%s, actionCode %d, while in state %d/%s",
                                              err, StrMediaError(err).c_str(), actionCode,
                                              mState, stateString(mState).c_str());
                    if (err == DEAD_OBJECT) {
                        mFlags |= kFlagSawMediaServerDie;
                        mFlags &= ~kFlagIsComponentAllocated;
+19 −2
Original line number Diff line number Diff line
@@ -163,11 +163,28 @@ static inline bool isCryptoError(status_t err) {
            || (ERROR_DRM_VENDOR_MIN <= err && err <= ERROR_DRM_VENDOR_MAX);
}

static inline std::string StrCryptoError(status_t err) {
#define STATUS_CASE(STATUS) \
    case STATUS:            \
        return #STATUS

static inline std::string StrMediaError(status_t err) {
    switch(err) {
        STATUS_CASE(ERROR_ALREADY_CONNECTED);
        STATUS_CASE(ERROR_NOT_CONNECTED);
        STATUS_CASE(ERROR_UNKNOWN_HOST);
        STATUS_CASE(ERROR_CANNOT_CONNECT);
        STATUS_CASE(ERROR_IO);
        STATUS_CASE(ERROR_CONNECTION_LOST);
        STATUS_CASE(ERROR_MALFORMED);
        STATUS_CASE(ERROR_OUT_OF_RANGE);
        STATUS_CASE(ERROR_BUFFER_TOO_SMALL);
        STATUS_CASE(ERROR_UNSUPPORTED);
        STATUS_CASE(ERROR_END_OF_STREAM);
    }
    return statusToString(err);
}

static inline std::string StrCryptoError(status_t err) {
    switch (err) {
        STATUS_CASE(ERROR_DRM_UNKNOWN);
        STATUS_CASE(ERROR_DRM_NO_LICENSE);
@@ -209,10 +226,10 @@ static inline std::string StrCryptoError(status_t err) {
        STATUS_CASE(ERROR_DRM_STORAGE_READ);
        STATUS_CASE(ERROR_DRM_STORAGE_WRITE);
        STATUS_CASE(ERROR_DRM_ZERO_SUBSAMPLES);
#undef STATUS_CASE
    }
    return statusToString(err);
}
#undef STATUS_CASE

}  // namespace android

+2 −2
Original line number Diff line number Diff line
@@ -256,8 +256,8 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) {
                         break;
                     }
                     msg->findString("detail", &detail);
                     ALOGE("Codec reported error(0x%x), actionCode(%d), detail(%s)",
                           err, actionCode, detail.c_str());
                     ALOGE("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)",
                           err, StrMediaError(err).c_str(), actionCode, detail.c_str());

                     Mutex::Autolock _l(mCodec->mAsyncCallbackLock);
                     if (mCodec->mAsyncCallback.onAsyncError != NULL) {