十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
codec编码传输流程是怎么样的,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
成都创新互联公司-专业网站定制、快速模板网站建设、高性价比易县网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式易县网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖易县地区。费用合理售后完善,十多年实体公司更值得信赖。
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
#11 pc 0008a731 /system/lib/libstagefright.so (android::ACodec::BaseState::onMessageReceived(android::sp
#12 pc 0008e779 /system/lib/libstagefright.so (android::ACodec::ExecutingState::onMessageReceived(android::sp
#13 pc 0000b5a1 /system/lib/libstagefright_foundation.so (android::AHierarchicalStateMachine::handleMessage(android::sp
#14 pc 0008a917 /system/lib/libstagefright.so (android::ACodec::BaseState::onOMXMessageList(android::sp
#15 pc 0008a5e7 /system/lib/libstagefright.so (android::ACodec::BaseState::onMessageReceived(android::sp
#16 pc 0008e779 /system/lib/libstagefright.so (android::ACodec::ExecutingState::onMessageReceived(android::sp
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。