MediaRecorder start error codes

后端 未结 2 1636
猫巷女王i
猫巷女王i 2021-01-12 06:06

I want to record raw h.264 video without sound and possibly HW accelerated (and stream it later). So I decided to use MediaRecorder (and the socket hack

2条回答
  •  没有蜡笔的小新
    2021-01-12 06:08

    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.

提交回复
热议问题