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

Commit 8a133921 authored by Ray Essick's avatar Ray Essick Committed by Automerger Merge Worker
Browse files

Merge "Limit an NdkMediaCodec diagnostic" into tm-dev am: 8b3fc290

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/17171913

Change-Id: I2558a3c3dfc10ea926631825ff280ad3290bfd23
parents b01515b2 8b3fc290
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */

#include <inttypes.h>
#include <mutex>
#include <set>

//#define LOG_NDEBUG 0
#define LOG_TAG "NdkMediaCodec"
@@ -42,6 +44,7 @@ using namespace android;


static media_status_t translate_error(status_t err) {

    if (err == OK) {
        return AMEDIA_OK;
    } else if (err == -EAGAIN) {
@@ -51,7 +54,18 @@ static media_status_t translate_error(status_t err) {
    } else if (err == DEAD_OBJECT) {
        return AMEDIACODEC_ERROR_RECLAIMED;
    }
    ALOGE("sf error code: %d", err);

    {
        // minimize log flooding. Some CTS behavior made this noisy and apps could do the same.
        static std::set<status_t> untranslated;
        static std::mutex mutex;
        std::lock_guard lg(mutex);

        if (untranslated.find(err) == untranslated.end()) {
            ALOGE("untranslated sf error code: %d", err);
            untranslated.insert(err);
        }
    }
    return AMEDIA_ERROR_UNKNOWN;
}