您好,登錄后才能下訂單哦!
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)
看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業資訊頻道,感謝您對億速云的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。