codec編碼傳輸流程是怎么樣的,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。
創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的上蔡網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴! SurfaceMediaSource::read()鎖控制從IGraphicBufferConsumer處讀取buffer,當(dāng)graphic產(chǎn)生數(shù)據(jù)
Overrun時(shí)等待
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數(shù)據(jù)到codec的mEncoderInputBuffers
通過(guò)這個(gè)while循環(huán)來(lái)等待拷貝
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. 上面流程傳遞的是主要是共享內(nèi)存buffer_handle_t,當(dāng)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來(lái)真正釋放
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
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)的支持。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。