Loading include/media/stagefright/ACodec.h +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ struct ACodec : public AHierarchicalStateMachine { void initiateConfigureComponent(const sp<AMessage> &msg); void initiateStart(); void signalRequestIDRFrame(); struct PortDescription : public RefBase { size_t countBuffers(); IOMX::buffer_id bufferIDAt(size_t index) const; Loading Loading @@ -102,6 +104,7 @@ private: kWhatAllocateComponent = 'allo', kWhatConfigureComponent = 'conf', kWhatStart = 'star', kWhatRequestIDRFrame = 'ridr', }; enum { Loading Loading @@ -262,6 +265,8 @@ private: OMX_ERRORTYPE error = OMX_ErrorUndefined, status_t internalError = UNKNOWN_ERROR); status_t requestIDRFrame(); DISALLOW_EVIL_CONSTRUCTORS(ACodec); }; Loading include/media/stagefright/MediaCodec.h +3 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,8 @@ struct MediaCodec : public AHandler { status_t getInputBuffers(Vector<sp<ABuffer> > *buffers) const; status_t getOutputBuffers(Vector<sp<ABuffer> > *buffers) const; status_t requestIDRFrame(); protected: virtual ~MediaCodec(); virtual void onMessageReceived(const sp<AMessage> &msg); Loading Loading @@ -145,6 +147,7 @@ private: kWhatDequeueInputTimedOut = 'dITO', kWhatDequeueOutputTimedOut = 'dOTO', kWhatCodecNotify = 'codc', kWhatRequestIDRFrame = 'ridr', }; enum { Loading media/libstagefright/ACodec.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ #include <OMX_Component.h> #include "include/avc_utils.h" namespace android { template<class T> Loading Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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) { Loading Loading @@ -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; Loading media/libstagefright/MediaCodec.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,12 @@ status_t MediaCodec::flush() { return PostAndAwaitResponse(msg, &response); } status_t MediaCodec::requestIDRFrame() { (new AMessage(kWhatRequestIDRFrame, id()))->post(); return OK; } //////////////////////////////////////////////////////////////////////////////// void MediaCodec::cancelPendingDequeueOperations() { Loading Loading @@ -1133,6 +1139,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { break; } case kWhatRequestIDRFrame: { mCodec->signalRequestIDRFrame(); break; } default: TRESPASS(); } Loading media/libstagefright/wifi-display/source/Converter.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -40,7 +40,15 @@ Converter::Converter( mNotify(notify), mCodecLooper(codecLooper), mInputFormat(format), mIsVideo(false), mDoMoreWorkPending(false) { AString mime; CHECK(mInputFormat->findString("mime", &mime)); if (!strncasecmp("video/", mime.c_str(), 6)) { mIsVideo = true; } mInitCheck = initEncoder(); } Loading Loading @@ -202,6 +210,15 @@ void Converter::onMessageReceived(const sp<AMessage> &msg) { break; } case kWhatRequestIDRFrame: { if (mIsVideo) { ALOGI("requesting IDR frame"); mEncoder->requestIDRFrame(); } break; } default: TRESPASS(); } Loading Loading @@ -306,5 +323,9 @@ status_t Converter::doMoreWork() { return err; } void Converter::requestIDRFrame() { (new AMessage(kWhatRequestIDRFrame, id()))->post(); } } // namespace android Loading
include/media/stagefright/ACodec.h +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ struct ACodec : public AHierarchicalStateMachine { void initiateConfigureComponent(const sp<AMessage> &msg); void initiateStart(); void signalRequestIDRFrame(); struct PortDescription : public RefBase { size_t countBuffers(); IOMX::buffer_id bufferIDAt(size_t index) const; Loading Loading @@ -102,6 +104,7 @@ private: kWhatAllocateComponent = 'allo', kWhatConfigureComponent = 'conf', kWhatStart = 'star', kWhatRequestIDRFrame = 'ridr', }; enum { Loading Loading @@ -262,6 +265,8 @@ private: OMX_ERRORTYPE error = OMX_ErrorUndefined, status_t internalError = UNKNOWN_ERROR); status_t requestIDRFrame(); DISALLOW_EVIL_CONSTRUCTORS(ACodec); }; Loading
include/media/stagefright/MediaCodec.h +3 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,8 @@ struct MediaCodec : public AHandler { status_t getInputBuffers(Vector<sp<ABuffer> > *buffers) const; status_t getOutputBuffers(Vector<sp<ABuffer> > *buffers) const; status_t requestIDRFrame(); protected: virtual ~MediaCodec(); virtual void onMessageReceived(const sp<AMessage> &msg); Loading Loading @@ -145,6 +147,7 @@ private: kWhatDequeueInputTimedOut = 'dITO', kWhatDequeueOutputTimedOut = 'dOTO', kWhatCodecNotify = 'codc', kWhatRequestIDRFrame = 'ridr', }; enum { Loading
media/libstagefright/ACodec.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ #include <OMX_Component.h> #include "include/avc_utils.h" namespace android { template<class T> Loading Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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) { Loading Loading @@ -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; Loading
media/libstagefright/MediaCodec.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,12 @@ status_t MediaCodec::flush() { return PostAndAwaitResponse(msg, &response); } status_t MediaCodec::requestIDRFrame() { (new AMessage(kWhatRequestIDRFrame, id()))->post(); return OK; } //////////////////////////////////////////////////////////////////////////////// void MediaCodec::cancelPendingDequeueOperations() { Loading Loading @@ -1133,6 +1139,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { break; } case kWhatRequestIDRFrame: { mCodec->signalRequestIDRFrame(); break; } default: TRESPASS(); } Loading
media/libstagefright/wifi-display/source/Converter.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -40,7 +40,15 @@ Converter::Converter( mNotify(notify), mCodecLooper(codecLooper), mInputFormat(format), mIsVideo(false), mDoMoreWorkPending(false) { AString mime; CHECK(mInputFormat->findString("mime", &mime)); if (!strncasecmp("video/", mime.c_str(), 6)) { mIsVideo = true; } mInitCheck = initEncoder(); } Loading Loading @@ -202,6 +210,15 @@ void Converter::onMessageReceived(const sp<AMessage> &msg) { break; } case kWhatRequestIDRFrame: { if (mIsVideo) { ALOGI("requesting IDR frame"); mEncoder->requestIDRFrame(); } break; } default: TRESPASS(); } Loading Loading @@ -306,5 +323,9 @@ status_t Converter::doMoreWork() { return err; } void Converter::requestIDRFrame() { (new AMessage(kWhatRequestIDRFrame, id()))->post(); } } // namespace android