Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the transmission process of codec coding?

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Codec coding transmission process is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

The SurfaceMediaSource::read () lock controls reading the buffer from the IGraphicBufferConsumer, when the graphic generates data

Wait while Overrun

While (mStarted & & mNumPendingBuffers = = mMaxAcquiredBufferCount) {

MMediaBuffersAvailableCondition.wait (mMutex)

}

After MediaPuller got the buffer,

Status_t err = mSource- > read (& mbuf)

Notify- > setInt32 ("what", kWhatAccessUnit)

Notify- > setBuffer ("accessUnit", accessUnit)

Notify- > post ()

Converter receives CHECK_EQ (what, MediaPuller::kWhatAccessUnit)

After

MInputBufferQueue.push_back (accessUnit)

FeedEncoderInputBuffers ()

Copy buffer data to mEncoderInputBuffers of codec in Converter::feedEncoderInputBuffers ()

Wait for the copy through this while loop

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. The above process passes mainly the shared memory buffer_handle_t, when the codec completes the 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)

To inform SurfaceMediaSource::signalBufferReturned () to let graphic consumer actually release

MConsumer- > releaseBuffer ()

Stack information

# 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 const&) + 228)

# 11 pc 0008a731 / system/lib/libstagefright.so (android::ACodec::BaseState::onMessageReceived (android::sp const&) + 744)

# 12 pc 0008e779 / system/lib/libstagefright.so (android::ACodec::ExecutingState::onMessageReceived (android::sp const&) + 508)

# 13 pc 0000b5a1 / system/lib/libstagefright_foundation.so (android::AHierarchicalStateMachine::handleMessage (android::sp const&) + 64)

# 14 pc 0008a917 / system/lib/libstagefright.so (android::ACodec::BaseState::onOMXMessageList (android::sp const&) + 106)

# 15 pc 0008a5e7 / system/lib/libstagefright.so (android::ACodec::BaseState::onMessageReceived (android::sp const&) + 414)

# 16 pc 0008e779 / system/lib/libstagefright.so (android::ACodec::ExecutingState::onMessageReceived (android::sp const&) + 508)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report