MediaRecorder start error codes

邮差的信 提交于 2019-12-01 04:18:26

Alright, I think I have an answer for you. The start function that is failing is defined in a file called mediarecorder.cpp. Found here:

frameworks/av/media/libmedia/mediarecorder.cpp

This start function returns a variable of type status_t, and corresponds to the error that you're seeing thrown.

Now, the type status_t is defined in a file called Errors.h which can be found here:

system/core/include/utils/Errors.h

This defines an enumeration that corresponds to status_t as seen here:

enum {
    OK                = 0,    // Everything's swell.
    NO_ERROR          = 0,    // No errors.

    UNKNOWN_ERROR       = 0x80000000,

    NO_MEMORY           = -ENOMEM,
    INVALID_OPERATION   = -ENOSYS,
    BAD_VALUE           = -EINVAL,
    BAD_TYPE            = 0x80000001,
    NAME_NOT_FOUND      = -ENOENT,
    PERMISSION_DENIED   = -EPERM,
    NO_INIT             = -ENODEV,
    ALREADY_EXISTS      = -EEXIST,
    DEAD_OBJECT         = -EPIPE,
    FAILED_TRANSACTION  = 0x80000002,
    JPARKS_BROKE_IT     = -EPIPE,
#if !defined(HAVE_MS_C_RUNTIME)
    BAD_INDEX           = -EOVERFLOW,
    NOT_ENOUGH_DATA     = -ENODATA,
    WOULD_BLOCK         = -EWOULDBLOCK, 
    TIMED_OUT           = -ETIMEDOUT,
    UNKNOWN_TRANSACTION = -EBADMSG,
#else    
    BAD_INDEX           = -E2BIG,
    NOT_ENOUGH_DATA     = 0x80000003,
    WOULD_BLOCK         = 0x80000004,
    TIMED_OUT           = 0x80000005,
    UNKNOWN_TRANSACTION = 0x80000006,
#endif    
    FDS_NOT_ALLOWED     = 0x80000007,
};

As you can see, some of the values here are taken from errno.h, so we just need to see which one equates to a value of 38.

According to this source, 38 corresponds to ENOSYS. So, if we look back at the status_t enumeration, we can see that in android, ENOSYS corresponds to an invalid operation. Not terribly helpful, but I hope this at least points you in the right direction.

I have meet this error code in my call recorder app. this error code will show in logcat when you start media recorder while the Microphone is in use in another app like a Voice Assistant (for example: Ok google, etc) or another call recorder application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!