Loading media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,28 @@ void NuPlayer::Decoder::onMessageReceived(const sp<AMessage> &msg) { break; } case MediaCodec::CB_CRYPTO_ERROR: { status_t err; CHECK(msg->findInt32("err", &err)); AString comment; msg->findString("errorDetail", &comment); ALOGE("Decoder (%s) reported crypto error : 0x%x (%s)", mIsAudio ? "audio" : "video", err, comment.c_str()); handleError(err); break; } case MediaCodec::CB_REQUIRED_RESOURCES_CHANGED: case MediaCodec::CB_METRICS_FLUSHED: { // Nothing to do. Informational. Safe to ignore. break; } case MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE: // unexpected as we are not using large frames default: { TRESPASS(); Loading media/libstagefright/FrameDecoder.cpp +23 −10 Original line number Diff line number Diff line Loading @@ -247,14 +247,14 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { case FrameDecoder::kWhatCallbackNotify: int32_t callbackId; if (!msg->findInt32("callbackID", &callbackId)) { ALOGE("kWhatCallbackNotify: callbackID is expected."); ALOGD("kWhatCallbackNotify: callbackID is expected."); break; } switch (callbackId) { case MediaCodec::CB_INPUT_AVAILABLE: { int32_t index; if (!msg->findInt32("index", &index)) { ALOGE("CB_INPUT_AVAILABLE: index is expected."); ALOGD("CB_INPUT_AVAILABLE: index is expected."); break; } ALOGD("CB_INPUT_AVAILABLE received, index is %d", index); Loading @@ -269,7 +269,7 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { int64_t timeUs; CHECK(msg->findInt32("index", &index)); CHECK(msg->findInt64("timeUs", &timeUs)); ALOGD("CB_OUTPUT_AVAILABLE received, index is %d", index); ALOGV("CB_OUTPUT_AVAILABLE received, index is %d", index); sp<FrameDecoder> frameDecoder = mFrameDecoder.promote(); if (frameDecoder != nullptr) { frameDecoder->handleOutputBufferAsync(index, timeUs); Loading @@ -277,10 +277,10 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { break; } case MediaCodec::CB_OUTPUT_FORMAT_CHANGED: { ALOGD("CB_OUTPUT_FORMAT_CHANGED received"); ALOGV("CB_OUTPUT_FORMAT_CHANGED received"); sp<AMessage> format; if (!msg->findMessage("format", &format) || format == nullptr) { ALOGE("CB_OUTPUT_FORMAT_CHANGED: format is expected."); ALOGD("CB_OUTPUT_FORMAT_CHANGED: format is expected."); break; } sp<FrameDecoder> frameDecoder = mFrameDecoder.promote(); Loading @@ -294,25 +294,38 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { int32_t actionCode; AString detail; if (!msg->findInt32("err", &err)) { ALOGE("CB_ERROR: err is expected."); ALOGD("CB_ERROR: err is expected."); break; } if (!msg->findInt32("actionCode", &actionCode)) { ALOGE("CB_ERROR: actionCode is expected."); ALOGD("CB_ERROR: actionCode is expected."); break; } msg->findString("detail", &detail); ALOGE("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", err, ALOGI("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", err, StrMediaError(err).c_str(), actionCode, detail.c_str()); break; } case MediaCodec::CB_REQUIRED_RESOURCES_CHANGED: case MediaCodec::CB_METRICS_FLUSHED: { // Nothing to do. Informational. Safe to ignore. break; } case MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE: // unexpected as we are not using large frames case MediaCodec::CB_CRYPTO_ERROR: // unexpected as we are not using crypto default: ALOGE("kWhatCallbackNotify: callbackID(%d) is unexpected.", callbackId); { ALOGD("kWhatCallbackNotify: callbackID(%d) is unexpected.", callbackId); break; } } break; default: ALOGE("unexpected message received: %s", msg->debugString().c_str()); ALOGD("unexpected message received: %s", msg->debugString().c_str()); break; } } Loading media/libstagefright/MediaCodecSource.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1030,6 +1030,10 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { } signalEOS(); } // MediaCodec::CB_CRYPTO_ERROR is unexpected as we are not using crypto // MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE is unexpected as we are not using large frames // MediaCodec::CB_METRICS_FLUSHED is safe to ignore as it is informational only // MediaCodec::CB_REQUIRED_RESOURCES_CHANGED is safe to ignore as it is informational only break; } case kWhatStart: Loading media/libstagefright/include/media/stagefright/MediaCodec.h +1 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ struct MediaCodec : public AHandler { CB_OUTPUT_AVAILABLE = 2, CB_ERROR = 3, CB_OUTPUT_FORMAT_CHANGED = 4, CB_RESOURCE_RECLAIMED = 5, CB_RESOURCE_RECLAIMED = 5, // deprecated and not used CB_CRYPTO_ERROR = 6, CB_LARGE_FRAME_OUTPUT_AVAILABLE = 7, Loading media/ndk/NdkMediaCodec.cpp +56 −13 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { { int32_t cbID; if (!msg->findInt32("callbackID", &cbID)) { ALOGE("kWhatAsyncNotify: callbackID is expected."); ALOGD("kWhatAsyncNotify: callbackID is expected."); break; } Loading @@ -179,7 +179,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { { int32_t index; if (!msg->findInt32("index", &index)) { ALOGE("CB_INPUT_AVAILABLE: index is expected."); ALOGD("CB_INPUT_AVAILABLE: index is expected."); break; } Loading @@ -203,23 +203,23 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { int32_t flags; if (!msg->findInt32("index", &index)) { ALOGE("CB_OUTPUT_AVAILABLE: index is expected."); ALOGD("CB_OUTPUT_AVAILABLE: index is expected."); break; } if (!msg->findSize("offset", &offset)) { ALOGE("CB_OUTPUT_AVAILABLE: offset is expected."); ALOGD("CB_OUTPUT_AVAILABLE: offset is expected."); break; } if (!msg->findSize("size", &size)) { ALOGE("CB_OUTPUT_AVAILABLE: size is expected."); ALOGD("CB_OUTPUT_AVAILABLE: size is expected."); break; } if (!msg->findInt64("timeUs", &timeUs)) { ALOGE("CB_OUTPUT_AVAILABLE: timeUs is expected."); ALOGD("CB_OUTPUT_AVAILABLE: timeUs is expected."); break; } if (!msg->findInt32("flags", &flags)) { ALOGE("CB_OUTPUT_AVAILABLE: flags is expected."); ALOGD("CB_OUTPUT_AVAILABLE: flags is expected."); break; } Loading @@ -245,7 +245,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { { sp<AMessage> format; if (!msg->findMessage("format", &format)) { ALOGE("CB_OUTPUT_FORMAT_CHANGED: format is expected."); ALOGD("CB_OUTPUT_FORMAT_CHANGED: format is expected."); break; } Loading Loading @@ -274,15 +274,15 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { int32_t actionCode; AString detail; if (!msg->findInt32("err", &err)) { ALOGE("CB_ERROR: err is expected."); ALOGD("CB_ERROR: err is expected."); break; } if (!msg->findInt32("actionCode", &actionCode)) { ALOGE("CB_ERROR: actionCode is expected."); ALOGD("CB_ERROR: actionCode is expected."); break; } msg->findString("detail", &detail); ALOGE("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", ALOGI("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", err, StrMediaError(err).c_str(), actionCode, detail.c_str()); Mutex::Autolock _l(mCodec->mAsyncCallbackLock); Loading @@ -298,9 +298,52 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { break; } case MediaCodec::CB_CRYPTO_ERROR: { status_t err; int32_t actionCode; AString detail; if (!msg->findInt32("err", &err)) { ALOGD("CB_ERROR: err is expected."); break; } if (!msg->findInt32("actionCode", &actionCode)) { ALOGD("CB_ERROR: actionCode is expected."); break; } msg->findString("errorDetail", &detail); ALOGI("Codec reported crypto error(0x%x/%s), actionCode(%d), detail(%s)" " that cannot be passed to the NDK client", err, StrMediaError(err).c_str(), actionCode, detail.c_str()); // TODO: handle crypto error. We could in theory pass this via the regular // onAsyncError callback, but clients are not expecting it, and would make // it harder to distinguish between crypto and non-crypto errors in the // future. break; } case MediaCodec::CB_REQUIRED_RESOURCES_CHANGED: { ALOGV("kWhatAsyncNotify: ignoring CB_REQUIRED_RESOURCES_CHANGED event."); break; } case MediaCodec::CB_METRICS_FLUSHED: { ALOGV("kWhatAsyncNotify: ignoring CB_METRICS_FLUSHED event."); break; } case MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE: { ALOGD("kWhatAsyncNotify: ignoring CB_LARGE_FRAME_OUTPUT_AVAILABLE event."); // TODO: handle large frame output in NDK API. break; } default: { ALOGE("kWhatAsyncNotify: callbackID(%d) is unexpected.", cbID); ALOGD("kWhatAsyncNotify: callbackID(%d) is unexpected.", cbID); break; } } Loading Loading @@ -390,7 +433,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { } default: ALOGE("shouldn't be here"); ALOGD("unexpected message received: %d. shouldn't be here", msg->what()); break; } Loading Loading
media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,28 @@ void NuPlayer::Decoder::onMessageReceived(const sp<AMessage> &msg) { break; } case MediaCodec::CB_CRYPTO_ERROR: { status_t err; CHECK(msg->findInt32("err", &err)); AString comment; msg->findString("errorDetail", &comment); ALOGE("Decoder (%s) reported crypto error : 0x%x (%s)", mIsAudio ? "audio" : "video", err, comment.c_str()); handleError(err); break; } case MediaCodec::CB_REQUIRED_RESOURCES_CHANGED: case MediaCodec::CB_METRICS_FLUSHED: { // Nothing to do. Informational. Safe to ignore. break; } case MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE: // unexpected as we are not using large frames default: { TRESPASS(); Loading
media/libstagefright/FrameDecoder.cpp +23 −10 Original line number Diff line number Diff line Loading @@ -247,14 +247,14 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { case FrameDecoder::kWhatCallbackNotify: int32_t callbackId; if (!msg->findInt32("callbackID", &callbackId)) { ALOGE("kWhatCallbackNotify: callbackID is expected."); ALOGD("kWhatCallbackNotify: callbackID is expected."); break; } switch (callbackId) { case MediaCodec::CB_INPUT_AVAILABLE: { int32_t index; if (!msg->findInt32("index", &index)) { ALOGE("CB_INPUT_AVAILABLE: index is expected."); ALOGD("CB_INPUT_AVAILABLE: index is expected."); break; } ALOGD("CB_INPUT_AVAILABLE received, index is %d", index); Loading @@ -269,7 +269,7 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { int64_t timeUs; CHECK(msg->findInt32("index", &index)); CHECK(msg->findInt64("timeUs", &timeUs)); ALOGD("CB_OUTPUT_AVAILABLE received, index is %d", index); ALOGV("CB_OUTPUT_AVAILABLE received, index is %d", index); sp<FrameDecoder> frameDecoder = mFrameDecoder.promote(); if (frameDecoder != nullptr) { frameDecoder->handleOutputBufferAsync(index, timeUs); Loading @@ -277,10 +277,10 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { break; } case MediaCodec::CB_OUTPUT_FORMAT_CHANGED: { ALOGD("CB_OUTPUT_FORMAT_CHANGED received"); ALOGV("CB_OUTPUT_FORMAT_CHANGED received"); sp<AMessage> format; if (!msg->findMessage("format", &format) || format == nullptr) { ALOGE("CB_OUTPUT_FORMAT_CHANGED: format is expected."); ALOGD("CB_OUTPUT_FORMAT_CHANGED: format is expected."); break; } sp<FrameDecoder> frameDecoder = mFrameDecoder.promote(); Loading @@ -294,25 +294,38 @@ void AsyncCodecHandler::onMessageReceived(const sp<AMessage>& msg) { int32_t actionCode; AString detail; if (!msg->findInt32("err", &err)) { ALOGE("CB_ERROR: err is expected."); ALOGD("CB_ERROR: err is expected."); break; } if (!msg->findInt32("actionCode", &actionCode)) { ALOGE("CB_ERROR: actionCode is expected."); ALOGD("CB_ERROR: actionCode is expected."); break; } msg->findString("detail", &detail); ALOGE("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", err, ALOGI("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", err, StrMediaError(err).c_str(), actionCode, detail.c_str()); break; } case MediaCodec::CB_REQUIRED_RESOURCES_CHANGED: case MediaCodec::CB_METRICS_FLUSHED: { // Nothing to do. Informational. Safe to ignore. break; } case MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE: // unexpected as we are not using large frames case MediaCodec::CB_CRYPTO_ERROR: // unexpected as we are not using crypto default: ALOGE("kWhatCallbackNotify: callbackID(%d) is unexpected.", callbackId); { ALOGD("kWhatCallbackNotify: callbackID(%d) is unexpected.", callbackId); break; } } break; default: ALOGE("unexpected message received: %s", msg->debugString().c_str()); ALOGD("unexpected message received: %s", msg->debugString().c_str()); break; } } Loading
media/libstagefright/MediaCodecSource.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1030,6 +1030,10 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { } signalEOS(); } // MediaCodec::CB_CRYPTO_ERROR is unexpected as we are not using crypto // MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE is unexpected as we are not using large frames // MediaCodec::CB_METRICS_FLUSHED is safe to ignore as it is informational only // MediaCodec::CB_REQUIRED_RESOURCES_CHANGED is safe to ignore as it is informational only break; } case kWhatStart: Loading
media/libstagefright/include/media/stagefright/MediaCodec.h +1 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ struct MediaCodec : public AHandler { CB_OUTPUT_AVAILABLE = 2, CB_ERROR = 3, CB_OUTPUT_FORMAT_CHANGED = 4, CB_RESOURCE_RECLAIMED = 5, CB_RESOURCE_RECLAIMED = 5, // deprecated and not used CB_CRYPTO_ERROR = 6, CB_LARGE_FRAME_OUTPUT_AVAILABLE = 7, Loading
media/ndk/NdkMediaCodec.cpp +56 −13 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { { int32_t cbID; if (!msg->findInt32("callbackID", &cbID)) { ALOGE("kWhatAsyncNotify: callbackID is expected."); ALOGD("kWhatAsyncNotify: callbackID is expected."); break; } Loading @@ -179,7 +179,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { { int32_t index; if (!msg->findInt32("index", &index)) { ALOGE("CB_INPUT_AVAILABLE: index is expected."); ALOGD("CB_INPUT_AVAILABLE: index is expected."); break; } Loading @@ -203,23 +203,23 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { int32_t flags; if (!msg->findInt32("index", &index)) { ALOGE("CB_OUTPUT_AVAILABLE: index is expected."); ALOGD("CB_OUTPUT_AVAILABLE: index is expected."); break; } if (!msg->findSize("offset", &offset)) { ALOGE("CB_OUTPUT_AVAILABLE: offset is expected."); ALOGD("CB_OUTPUT_AVAILABLE: offset is expected."); break; } if (!msg->findSize("size", &size)) { ALOGE("CB_OUTPUT_AVAILABLE: size is expected."); ALOGD("CB_OUTPUT_AVAILABLE: size is expected."); break; } if (!msg->findInt64("timeUs", &timeUs)) { ALOGE("CB_OUTPUT_AVAILABLE: timeUs is expected."); ALOGD("CB_OUTPUT_AVAILABLE: timeUs is expected."); break; } if (!msg->findInt32("flags", &flags)) { ALOGE("CB_OUTPUT_AVAILABLE: flags is expected."); ALOGD("CB_OUTPUT_AVAILABLE: flags is expected."); break; } Loading @@ -245,7 +245,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { { sp<AMessage> format; if (!msg->findMessage("format", &format)) { ALOGE("CB_OUTPUT_FORMAT_CHANGED: format is expected."); ALOGD("CB_OUTPUT_FORMAT_CHANGED: format is expected."); break; } Loading Loading @@ -274,15 +274,15 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { int32_t actionCode; AString detail; if (!msg->findInt32("err", &err)) { ALOGE("CB_ERROR: err is expected."); ALOGD("CB_ERROR: err is expected."); break; } if (!msg->findInt32("actionCode", &actionCode)) { ALOGE("CB_ERROR: actionCode is expected."); ALOGD("CB_ERROR: actionCode is expected."); break; } msg->findString("detail", &detail); ALOGE("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", ALOGI("Codec reported error(0x%x/%s), actionCode(%d), detail(%s)", err, StrMediaError(err).c_str(), actionCode, detail.c_str()); Mutex::Autolock _l(mCodec->mAsyncCallbackLock); Loading @@ -298,9 +298,52 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { break; } case MediaCodec::CB_CRYPTO_ERROR: { status_t err; int32_t actionCode; AString detail; if (!msg->findInt32("err", &err)) { ALOGD("CB_ERROR: err is expected."); break; } if (!msg->findInt32("actionCode", &actionCode)) { ALOGD("CB_ERROR: actionCode is expected."); break; } msg->findString("errorDetail", &detail); ALOGI("Codec reported crypto error(0x%x/%s), actionCode(%d), detail(%s)" " that cannot be passed to the NDK client", err, StrMediaError(err).c_str(), actionCode, detail.c_str()); // TODO: handle crypto error. We could in theory pass this via the regular // onAsyncError callback, but clients are not expecting it, and would make // it harder to distinguish between crypto and non-crypto errors in the // future. break; } case MediaCodec::CB_REQUIRED_RESOURCES_CHANGED: { ALOGV("kWhatAsyncNotify: ignoring CB_REQUIRED_RESOURCES_CHANGED event."); break; } case MediaCodec::CB_METRICS_FLUSHED: { ALOGV("kWhatAsyncNotify: ignoring CB_METRICS_FLUSHED event."); break; } case MediaCodec::CB_LARGE_FRAME_OUTPUT_AVAILABLE: { ALOGD("kWhatAsyncNotify: ignoring CB_LARGE_FRAME_OUTPUT_AVAILABLE event."); // TODO: handle large frame output in NDK API. break; } default: { ALOGE("kWhatAsyncNotify: callbackID(%d) is unexpected.", cbID); ALOGD("kWhatAsyncNotify: callbackID(%d) is unexpected.", cbID); break; } } Loading Loading @@ -390,7 +433,7 @@ void CodecHandler::onMessageReceived(const sp<AMessage> &msg) { } default: ALOGE("shouldn't be here"); ALOGD("unexpected message received: %d. shouldn't be here", msg->what()); break; } Loading