diff options
author | Andreas Huber <andih@google.com> | 2012-09-13 16:43:51 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-09-13 16:43:51 -0700 |
commit | 496238cc7551d414067dcbbb4fe3bd801f205f95 (patch) | |
tree | 90e4402e792c22804bf42f6f773c97e57d06e5dc /media/libstagefright/ACodec.cpp | |
parent | f4bca03d996b584030a80268f58cdb29dc7b7cde (diff) | |
download | frameworks_av-496238cc7551d414067dcbbb4fe3bd801f205f95.zip frameworks_av-496238cc7551d414067dcbbb4fe3bd801f205f95.tar.gz frameworks_av-496238cc7551d414067dcbbb4fe3bd801f205f95.tar.bz2 |
Support IDR requests in wifi display, MediaCodec and ACodec.
Change-Id: I596cf8dd61b63465437f78413186fad2be287244
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 3dd5d60..8190498 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -34,6 +34,8 @@ #include <OMX_Component.h> +#include "include/avc_utils.h" + namespace android { template<class T> @@ -401,6 +403,10 @@ void ACodec::initiateShutdown(bool keepComponentAllocated) { msg->post(); } +void ACodec::signalRequestIDRFrame() { + (new AMessage(kWhatRequestIDRFrame, id()))->post(); +} + status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput); @@ -2284,6 +2290,24 @@ error: ACodec::PortDescription::PortDescription() { } +status_t ACodec::requestIDRFrame() { + if (!mIsEncoder) { + return ERROR_UNSUPPORTED; + } + + OMX_CONFIG_INTRAREFRESHVOPTYPE params; + InitOMXParams(¶ms); + + params.nPortIndex = kPortIndexOutput; + params.IntraRefreshVOP = OMX_TRUE; + + return mOMX->setConfig( + mNode, + OMX_IndexConfigVideoIntraVOPRefresh, + ¶ms, + sizeof(params)); +} + void ACodec::PortDescription::addBuffer( IOMX::buffer_id id, const sp<ABuffer> &buffer) { mBufferIDs.push_back(id); @@ -2737,6 +2761,12 @@ bool ACodec::BaseState::onOMXFillBufferDone( if (mCodec->mNativeWindow == NULL) { info->mData->setRange(rangeOffset, rangeLength); + +#if 0 + if (IsIDR(info->mData)) { + ALOGI("IDR frame"); + } +#endif } if (mCodec->mSkipCutBuffer != NULL) { @@ -3400,6 +3430,17 @@ bool ACodec::ExecutingState::onMessageReceived(const sp<AMessage> &msg) { break; } + case kWhatRequestIDRFrame: + { + status_t err = mCodec->requestIDRFrame(); + if (err != OK) { + ALOGW("Requesting an IDR frame failed."); + } + + handled = true; + break; + } + default: handled = BaseState::onMessageReceived(msg); break; |