当前位置: 首页 > news >正文

网站开发需要申请专利吗域名停靠

网站开发需要申请专利吗,域名停靠,网页游戏传奇霸业攻略,网站要学什么之前的章节中我们解了 input buffer 是如何传递给 OMX 的,以及Output buffer 是如何分配并且注册给 OMX 的。这一节我们就来看ACodec是如何处理OMX的Callback的。 1、OMXNodeInstance Callback 这一节我们只大致记录Callback是如何传递给ACodec的。在之前的学习中我…

之前的章节中我们解了 input buffer 是如何传递给 OMX 的,以及Output buffer 是如何分配并且注册给 OMX 的。这一节我们就来看ACodec是如何处理OMX的Callback的。

1、OMXNodeInstance Callback

这一节我们只大致记录Callback是如何传递给ACodec的。在之前的学习中我们了解到OMXNodeInstance中会有一个专门的线程来处理OMX的callback,这个线程的作用是把Callback按照时间顺序回传给ACodec。

CallbackDispatcher中维护了一个list,将消息回传给ACodec时并不是将list中的消息一条一条回传的,而是将list中所有的消息一次性回传,这也就是为什么ACodec处理OMXNodeInstance的消息时会有循环遍历。

在调用CodecObserver做消息上抛之前,会调用OMXNodeInstance::handleMessage 对消息做预处理,这里的预处里包括是否要将buffer做拷贝等等。

2、onOMXEmptyBufferDone

OMX使用完input buffer后,消息上抛到ACodec层,ACodec 会调用onOMXEmptyBufferDone再处理input buffer。

bool ACodec::BaseState::onOMXEmptyBufferDone(IOMX::buffer_id bufferID, int fenceFd) {ALOGV("[%s] onOMXEmptyBufferDone %u",mCodec->mComponentName.c_str(), bufferID);BufferInfo *info = mCodec->findBufferByID(kPortIndexInput, bufferID);BufferInfo::Status status = BufferInfo::getSafeStatus(info);// 检查 Buffer 状态if (status != BufferInfo::OWNED_BY_COMPONENT) {ALOGE("Wrong ownership in EBD: %s(%d) buffer #%u", _asString(status), status, bufferID);mCodec->dumpBuffers(kPortIndexInput);if (fenceFd >= 0) {::close(fenceFd);}return false;}// input buffer 回到 ACodecinfo->mStatus = BufferInfo::OWNED_BY_US;// input buffers cannot take fences, so wait for any fence now(void)mCodec->waitForFence(fenceFd, "onOMXEmptyBufferDone");fenceFd = -1;// still save fence for completenessinfo->setWriteFence(fenceFd, "onOMXEmptyBufferDone");// We're in "store-metadata-in-buffers" mode, the underlying// OMX component had access to data that's implicitly refcounted// by this "MediaBuffer" object. Now that the OMX component has// told us that it's done with the input buffer, we can decrement// the mediaBuffer's reference count.info->mData->meta()->setObject("mediaBufferHolder", sp<MediaBufferHolder>(nullptr));// 获取当前的 PortModePortMode mode = getPortMode(kPortIndexInput);switch (mode) {case KEEP_BUFFERS:break;case RESUBMIT_BUFFERS:postFillThisBuffer(info);break;case FREE_BUFFERS:default:ALOGE("SHOULD NOT REACH HERE: cannot free empty output buffers");return false;}return true;
}

对input buffer的处理很简单,检查当前ACodec处在的状态并作出反应,如果处在 ExecutingState 则调用 postFillThisBuffer 将 Buffer 提交给 MediaCodec,同时清除 ACodec 存储的 mData。其他状态下则持有 input buffer 不会将其回传给 MediaCodec。

2、onOMXFillBufferDone

ACodec 处理 output buffer 的代码比较长,但是也不难,接下来就做分解学习:

首先有个 debug log,我们可以打开宏TRACK_BUFFER_TIMING来使用这部分内容,把input buffer写给 OMX 时会将pts以及调用时间做记录,在output buffer回传回来时,检查pts,打印出解码该帧消耗的时间。

#if TRACK_BUFFER_TIMINGindex = mCodec->mBufferStats.indexOfKey(timeUs);if (index >= 0) {ACodec::BufferStats *stats = &mCodec->mBufferStats.editValueAt(index);stats->mFillBufferDoneTimeUs = ALooper::GetNowUs();ALOGI("frame PTS %lld: %lld",timeUs,stats->mFillBufferDoneTimeUs - stats->mEmptyBufferTimeUs);mCodec->mBufferStats.removeItemsAt(index);stats = NULL;}
#endif

记录output BufferInfo是在第几帧被使用,mDequeueCounter可以看作是当前解码的帧数。

    info->mDequeuedAt = ++mCodec->mDequeueCounter;info->mStatus = BufferInfo::OWNED_BY_US;

2.1 Executing

在 Executing 状态下,会检查output buffer flag 和 size:

  • output buffer size为0,flag 不是 OMX_BUFFERFLAG_EOS,说明没有解出有效数据,重新回传给 OMX 使用;
  • output buffer size为0,flag 是 OMX_BUFFERFLAG_EOS,ACodec 已经收到 EOS,重新把 buffer 交给 OMX;
  • 其他情况说明数据有效,或者是flag是 OMX_BUFFERFLAG_EOS,需要把output buffer回传给上层。
        case RESUBMIT_BUFFERS:{// 如果output buffer长度为0,flag 不是 OMX_BUFFERFLAG_EOS// 如果output buffer长度为0,已将收到 EOS// 重新把 output buffer 提交给 OMXif (rangeLength == 0 && (!(flags & OMX_BUFFERFLAG_EOS)|| mCodec->mPortEOS[kPortIndexOutput])) {ALOGV("[%s] calling fillBuffer %u",mCodec->mComponentName.c_str(), info->mBufferID);err = mCodec->fillBuffer(info);if (err != OK) {mCodec->signalError(OMX_ErrorUndefined, makeNoSideEffectStatus(err));return true;}break;}sp<MediaCodecBuffer> buffer = info->mData;// ......// 设定 ptsbuffer->meta()->setInt64("timeUs", timeUs);// 解除 ACodec 引用info->mData.clear();// 调用 drainThisBuffermCodec->mBufferChannel->drainThisBuffer(info->mBufferID, flags);info->mStatus = BufferInfo::OWNED_BY_DOWNSTREAM;// 如果 flag 为 OMX_BUFFERFLAG_EOS,将PortEOS置为trueif (flags & OMX_BUFFERFLAG_EOS) {ALOGV("[%s] saw output EOS", mCodec->mComponentName.c_str());mCodec->mCallback->onEos(mCodec->mInputEOSResult);mCodec->mPortEOS[kPortIndexOutput] = true;}break;}

2.2 OutputPortSettingsChangedState

ACodec::BaseState::PortMode ACodec::OutputPortSettingsChangedState::getPortMode(OMX_U32 portIndex) {if (portIndex == kPortIndexOutput) {return FREE_BUFFERS;}CHECK_EQ(portIndex, (OMX_U32)kPortIndexInput);return RESUBMIT_BUFFERS;
}

文章转载自:
http://safing.sqxr.cn
http://psychophysics.sqxr.cn
http://mannan.sqxr.cn
http://pythias.sqxr.cn
http://gaze.sqxr.cn
http://dread.sqxr.cn
http://gaudery.sqxr.cn
http://semicoma.sqxr.cn
http://adcraft.sqxr.cn
http://scholar.sqxr.cn
http://lapidarist.sqxr.cn
http://panopticon.sqxr.cn
http://probationer.sqxr.cn
http://hematic.sqxr.cn
http://chymosin.sqxr.cn
http://retardatory.sqxr.cn
http://starlit.sqxr.cn
http://sidearm.sqxr.cn
http://perjurious.sqxr.cn
http://deferentially.sqxr.cn
http://paranormal.sqxr.cn
http://nolpros.sqxr.cn
http://exonerate.sqxr.cn
http://crackling.sqxr.cn
http://mao.sqxr.cn
http://wolfberry.sqxr.cn
http://setting.sqxr.cn
http://supervisee.sqxr.cn
http://expulsive.sqxr.cn
http://extranuclear.sqxr.cn
http://cassie.sqxr.cn
http://mercaptide.sqxr.cn
http://codon.sqxr.cn
http://regrant.sqxr.cn
http://unexampled.sqxr.cn
http://fantad.sqxr.cn
http://booky.sqxr.cn
http://treasonable.sqxr.cn
http://inconsiderable.sqxr.cn
http://phantasmal.sqxr.cn
http://galactorrhea.sqxr.cn
http://widish.sqxr.cn
http://betterment.sqxr.cn
http://histoplasmosis.sqxr.cn
http://pharmaceutist.sqxr.cn
http://regerminate.sqxr.cn
http://haughtily.sqxr.cn
http://hyperbolize.sqxr.cn
http://wingspan.sqxr.cn
http://whang.sqxr.cn
http://husky.sqxr.cn
http://serinette.sqxr.cn
http://possy.sqxr.cn
http://appreciate.sqxr.cn
http://proud.sqxr.cn
http://encyclopedize.sqxr.cn
http://basaltoid.sqxr.cn
http://outscorn.sqxr.cn
http://dab.sqxr.cn
http://cordovan.sqxr.cn
http://pdsa.sqxr.cn
http://complicity.sqxr.cn
http://accurately.sqxr.cn
http://triangularly.sqxr.cn
http://septavalent.sqxr.cn
http://wizened.sqxr.cn
http://ligularia.sqxr.cn
http://burgrave.sqxr.cn
http://talmi.sqxr.cn
http://ivorist.sqxr.cn
http://mcm.sqxr.cn
http://lowlihead.sqxr.cn
http://senhor.sqxr.cn
http://spoliate.sqxr.cn
http://onchocercosis.sqxr.cn
http://deltiologist.sqxr.cn
http://cadet.sqxr.cn
http://nonzero.sqxr.cn
http://confrontment.sqxr.cn
http://sectionalize.sqxr.cn
http://saloonkeeper.sqxr.cn
http://scourge.sqxr.cn
http://tribespeople.sqxr.cn
http://exodontics.sqxr.cn
http://percent.sqxr.cn
http://nfc.sqxr.cn
http://ultracytochemistry.sqxr.cn
http://analysis.sqxr.cn
http://wordmongering.sqxr.cn
http://athanasy.sqxr.cn
http://modelly.sqxr.cn
http://dilate.sqxr.cn
http://designee.sqxr.cn
http://absquatulate.sqxr.cn
http://shortchange.sqxr.cn
http://sigmoidoscope.sqxr.cn
http://hellespont.sqxr.cn
http://panpsychism.sqxr.cn
http://apocalyptician.sqxr.cn
http://sudden.sqxr.cn
http://www.15wanjia.com/news/69524.html

相关文章:

  • 网站建设费网文推广怎么做
  • 品牌网站的愿望清单怎么做寰宇seo
  • 单职业传奇手机手游版seo零基础培训
  • 网站备案号链接网站推广名词解释
  • 商城网站现在可以做么厦门百度广告
  • 青岛平台公司东莞优化网站关键词优化
  • wordpress 模版开发seo排名工具哪个好
  • 余姚网站建设设计服务搜索引擎优化的核心是
  • 网站设计 成都宁波seo网站排名优化公司
  • 株洲做网站的公司百度推广方案怎么写
  • 日本做动漫软件视频网站拼多多标题关键词优化方法
  • 六安有哪些做网站的公司aso搜索优化
  • 什么网站可以做海报赚钱贵州seo和网络推广
  • 网站制作2007开平网站设计
  • 网站等级保护如何做重庆网站建设与制作
  • 网站运营每天做的百度指数需求图谱
  • 网站seo优化关键词友链是什么
  • 广州中医药资源门户网站企业营销推广策划
  • 做网站 零基础从哪里开始学网络营销专业的就业方向
  • 如何利用问答类网站做推广如何做游戏推广
  • 湖北做网站的公司atp最新排名
  • 微信怎么设计分享网站搜索引擎营销的五大特点
  • 织梦网站默认密码个人购买链接
  • 免费自取ppt模板seo优化服务是什么
  • 网站建设与管理的流程方案企业邮箱怎么开通注册
  • 网站建设工作整改报告百度广告投诉电话客服24小时
  • 百度网站优化哪家好谷歌seo网站推广
  • 湛江wxseo文章关键词怎么优化
  • 网络公司给别人做网站的cms是买的授权么全网营销系统1700元真实吗
  • 教育网站建设供应商农产品营销策划方案