博客
关于我
ACodec从UninitializedState状态到LoadedState状态分析
阅读量:380 次
发布时间:2019-03-05

本文共 2603 字,大约阅读时间需要 8 分钟。

MediaCodec native???????create?config

MediaCodec??Android??????????native??????create?config?????????????????????????????????

????

?????mediacodec?create?config????native??????????????????????

??create?native?????

?mediacodec?????????????ACodec???ACodec???????????????????UninitializedState???????????

MediaCodec.cppstatus_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) {    // 1. ???ACodec    mCodec = new ACodec;        // 2. ?MediaCodec??????ALooper???ACodec??????    if (needDedicatedLooper) {        if (mCodecLooper == NULL) {            mCodecLooper = new ALooper;            mCodecLooper->setName("CodecLooper");            mCodecLooper->start(false, false, ANDROID_PRIORITY_AUDIO);        }        mCodecLooper->registerHandler(mCodec);    } else {        // 3. ?ACodec???MediaCodec???ALooper?        mLooper->registerHandler(mCodec);    }        // 4. ?MediaCodec???jni????ALooper?    mLooper->registerHandler(this);    mCodec->setNotificationMessage(new AMessage(kWhatCodecNotify, id()));        // 5. ????kWhatInit??    sp
msg = new AMessage(kWhatInit, id()); msg->setString("name", name); msg->setInt32("nameIsType", nameIsType); if (nameIsType) { msg->setInt32("encoder", encoder); } sp
response; return PostAndAwaitResponse(msg, &response);}
?????
  • ?????init?????????ACodec???ACodec??????????????AHierarchicalStateMachine????
  • ??????kWhatInit??????onMessageReceived?????
  • ?onMessageReceived??????????kWhatInit??????????UNINITIALIZED????????mReplyID??????INITIALIZING????ACodec?initiateAllocateComponent???

    ACodec?????

    ACodec?????AHierarchicalStateMachine????????UninitializedState?????changeState???????UninitializedState???kWhatAllocateComponent??????onAllocateComponent???

    onAllocateComponent????
  • ??mediaplayerservice????
  • ??OMXClient???OMX???
  • ?????????????
  • ??OMX::allocateNode?????
  • ???????????kWhatComponentAllocated????????LoadedState?
  • ??configur?native?????

    ?config???mediacodec???kWhatConfigure?????onMessageReceived?????

    onMessageReceived????

    ??????kWhatConfigure???initiateConfigureComponent???LoadedState?onMessageReceived?????kWhatConfigureComponent?????configureCodec???

    configureCodec????

    ??ACodec?configureCodec????????mime???componentName??????????

    ????

    mediacodec?create?config????native?????????????

  • ACodec?????????????init?????ACodec?????UninitializedState???
  • ?????????????????????kWhatInit?kWhatAllocateComponent????????
  • OMX????????OMXClient????????????????????
  • ???????AHierarchicalStateMachine??????????????????
  • ???????mediacodec?Android????????????????????????????????

    转载地址:http://gfwwz.baihongyu.com/

    你可能感兴趣的文章
    Netpas:不一样的SD-WAN+ 保障网络通讯品质
    查看>>
    Netty WebSocket客户端
    查看>>
    Netty工作笔记0011---Channel应用案例2
    查看>>
    Netty工作笔记0014---Buffer类型化和只读
    查看>>
    Netty工作笔记0050---Netty核心模块1
    查看>>
    Netty工作笔记0084---通过自定义协议解决粘包拆包问题2
    查看>>
    Netty常见组件二
    查看>>
    netty底层源码探究:启动流程;EventLoop中的selector、线程、任务队列;监听处理accept、read事件流程;
    查看>>
    Netty核心模块组件
    查看>>
    Netty框架的服务端开发中创建EventLoopGroup对象时线程数量源码解析
    查看>>
    Netty源码—2.Reactor线程模型一
    查看>>
    Netty源码—4.客户端接入流程一
    查看>>
    Netty源码—4.客户端接入流程二
    查看>>
    Netty源码—5.Pipeline和Handler一
    查看>>
    Netty源码—6.ByteBuf原理二
    查看>>
    Netty源码—7.ByteBuf原理三
    查看>>
    Netty源码—7.ByteBuf原理四
    查看>>
    Netty源码—8.编解码原理二
    查看>>
    Netty源码解读
    查看>>
    Netty的Socket编程详解-搭建服务端与客户端并进行数据传输
    查看>>