codec编码传输流程是怎么样的,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
SurfaceMediaSource::read()锁控制从IGraphicBufferConsumer处读取buffer,当graphic产生数据
Overrun时等待
while (mStarted && mNumPendingBuffers == mMaxAcquiredBufferCount) {
mMediaBuffersAvailableCondition.wait(mMutex);
}
MediaPuller拿到该buffer后
status_t err = mSource->read(&mbuf);
notify->setInt32("what", kWhatAccessUnit);
notify->setBuffer("accessUnit", accessUnit);
notify->post();
Converter 接收CHECK_EQ(what, MediaPuller::kWhatAccessUnit);
后
mInputBufferQueue.push_back(accessUnit);
feedEncoderInputBuffers();
Converter::feedEncoderInputBuffers() 中拷贝buffer数据到codec的mEncoderInputBuffers
通过这个while循环来等待拷贝
while (!mInputBufferQueue.empty()&& !mAvailEncoderInputIndices.empty()){
memcpy(mEncoderInputBuffers.itemAt(bufferIndex)->data(),
buffer->data(),
buffer->size());
status_t err = mEncoder->queueInputBuffer(
bufferIndex, 0, (buffer == NULL) ? 0 : buffer->size(),
timeUs, flags);
5. 上面流程传递的是主要是共享内存buffer_handle_t,当codec 完成ACodec::BaseState::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->setMediaBufferBase(NULL);
才通知SurfaceMediaSource::signalBufferReturned()让graphic consumer来真正释放
mConsumer->releaseBuffer();
Stack 信息
#06 pc 000f4583 /system/lib/libstagefright.so (android::SurfaceMediaSource::signalBufferReturned(android::MediaBuffer*)+38)
#07 pc 000f45a5 /system/lib/libstagefright.so (non-virtual thunk to android::SurfaceMediaSource::signalBufferReturned(android::MediaBuffer*)+4)
#08 pc 0000b011 /system/lib/libstagefright_foundation.so (android::ABuffer::setMediaBufferBase(android::MediaBufferBase*)+16)
#09 pc 0008adeb /system/lib/libstagefright.so (android::ACodec::BaseState::onOMXEmptyBufferDone(unsigned int, int)+78)
#10 pc 0008aab5 /system/lib/libstagefright.so (android::ACodec::BaseState::onOMXMessage(android::sp<android::AMessage> const&)+228)
#11 pc 0008a731 /system/lib/libstagefright.so (android::ACodec::BaseState::onMessageReceived(android::sp<android::AMessage> const&)+744)
#12 pc 0008e779 /system/lib/libstagefright.so (android::ACodec::ExecutingState::onMessageReceived(android::sp<android::AMessage> const&)+508)
#13 pc 0000b5a1 /system/lib/libstagefright_foundation.so (android::AHierarchicalStateMachine::handleMessage(android::sp<android::AMessage> const&)+64)
#14 pc 0008a917 /system/lib/libstagefright.so (android::ACodec::BaseState::onOMXMessageList(android::sp<android::AMessage> const&)+106)
#15 pc 0008a5e7 /system/lib/libstagefright.so (android::ACodec::BaseState::onMessageReceived(android::sp<android::AMessage> const&)+414)
#16 pc 0008e779 /system/lib/libstagefright.so (android::ACodec::ExecutingState::onMessageReceived(android::sp<android::AMessage> const&)+508)
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
标题名称:codec编码传输流程是怎么样的-创新互联
URL链接:https://www.cdcxhl.com/article2/cspooc.html
成都网站建设公司_创新互联,为您提供软件开发、营销型网站建设、App设计、微信公众号、网站设计、网站改版
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联