博客
关于我
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/

    你可能感兴趣的文章
    MySQL集群解决方案(4):负载均衡
    查看>>
    MySQL高级-视图
    查看>>
    Netpas:不一样的SD-WAN+ 保障网络通讯品质
    查看>>
    netty底层源码探究:启动流程;EventLoop中的selector、线程、任务队列;监听处理accept、read事件流程;
    查看>>
    Netty核心模块组件
    查看>>
    Netty源码—4.客户端接入流程一
    查看>>
    Netty源码—5.Pipeline和Handler一
    查看>>
    Netty源码—6.ByteBuf原理二
    查看>>
    Netty源码—7.ByteBuf原理三
    查看>>
    Netty源码—7.ByteBuf原理四
    查看>>
    Netty的Socket编程详解-搭建服务端与客户端并进行数据传输
    查看>>
    Network Dissection:Quantifying Interpretability of Deep Visual Representations(深层视觉表征的量化解释)
    查看>>
    Network Sniffer and Connection Analyzer
    查看>>
    Nginx + uWSGI + Flask + Vhost
    查看>>
    Nginx Location配置总结
    查看>>
    Nginx 反向代理解决跨域问题
    查看>>
    nginx 后端获取真实ip
    查看>>
    Nginx 学习总结(17)—— 8 个免费开源 Nginx 管理系统,轻松管理 Nginx 站点配置
    查看>>
    nginx 常用配置记录
    查看>>
    Nginx 我们必须知道的那些事
    查看>>