Loading include/media/stagefright/ACodec.h +4 −0 Original line number Diff line number Diff line Loading @@ -371,6 +371,10 @@ private: int32_t width, int32_t height, OMX_VIDEO_CODINGTYPE compressionFormat, float frameRate = -1.0); // sets |portIndex| port buffer numbers to be |bufferNum|. NOTE: Component could reject // this setting if the |bufferNum| is less than the minimum buffer num of the port. status_t setPortBufferNum(OMX_U32 portIndex, int bufferNum); // gets index or sets it to 0 on error. Returns error from codec. status_t initDescribeColorAspectsIndex(); Loading media/libstagefright/ACodec.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -3146,6 +3146,29 @@ static status_t GetMimeTypeForVideoCoding( return ERROR_UNSUPPORTED; } status_t ACodec::setPortBufferNum(OMX_U32 portIndex, int bufferNum) { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = portIndex; status_t err; ALOGD("Setting [%s] %s port buffer number: %d", mComponentName.c_str(), portIndex == kPortIndexInput ? "input" : "output", bufferNum); err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { return err; } def.nBufferCountActual = bufferNum; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { // Component could reject this request. ALOGW("Fail to set [%s] %s port buffer number: %d", mComponentName.c_str(), portIndex == kPortIndexInput ? "input" : "output", bufferNum); } return OK; } status_t ACodec::setupVideoDecoder( const char *mime, const sp<AMessage> &msg, bool haveNativeWindow, bool usingSwRenderer, sp<AMessage> &outputFormat) { Loading Loading @@ -3202,6 +3225,24 @@ status_t ACodec::setupVideoDecoder( return err; } // Set the component input buffer number to be |tmp|. If succeed, // component will set input port buffer number to be |tmp|. If fail, // component will keep the same buffer number as before. if (msg->findInt32("android._num-input-buffers", &tmp)) { err = setPortBufferNum(kPortIndexInput, tmp); if (err != OK) return err; } // Set the component output buffer number to be |tmp|. If succeed, // component will set output port buffer number to be |tmp|. If fail, // component will keep the same buffer number as before. if (msg->findInt32("android._num-output-buffers", &tmp)) { err = setPortBufferNum(kPortIndexOutput, tmp); if (err != OK) return err; } int32_t frameRateInt; float frameRateFloat; if (!msg->findFloat("frame-rate", &frameRateFloat)) { Loading media/libstagefright/StagefrightMetadataRetriever.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,12 @@ static VideoFrame *extractVideoFrame( // TODO: Use Flexible color instead videoFormat->setInt32("color-format", OMX_COLOR_FormatYUV420Planar); // For the thumbnail extraction case, try to allocate single buffer // in both input and output ports. NOTE: This request may fail if // component requires more than that for decoding. videoFormat->setInt32("android._num-input-buffers", 1); videoFormat->setInt32("android._num-output-buffers", 1); status_t err; sp<ALooper> looper = new ALooper; looper->start(); Loading media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,8 @@ SoftAVC::SoftAVC( mSignalledError(false), mStride(mWidth){ initPorts( kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); 1 /* numMinInputBuffers */, kNumBuffers, INPUT_BUF_SIZE, 1 /* numMinOutputBuffers */, kNumBuffers, CODEC_MIME_TYPE); GETTIME(&mTimeStart, NULL); Loading media/libstagefright/include/SoftVideoDecoderOMXComponent.h +15 −0 Original line number Diff line number Diff line Loading @@ -76,12 +76,27 @@ protected: virtual int getColorAspectPreference(); // This function sets both minimum buffer count and actual buffer count of // input port to be |numInputBuffers|. It will also set both minimum buffer // count and actual buffer count of output port to be |numOutputBuffers|. void initPorts(OMX_U32 numInputBuffers, OMX_U32 inputBufferSize, OMX_U32 numOutputBuffers, const char *mimeType, OMX_U32 minCompressionRatio = 1u); // This function sets input port's minimum buffer count to |numMinInputBuffers|, // sets input port's actual buffer count to |numInputBuffers|, sets output port's // minimum buffer count to |numMinOutputBuffers| and sets output port's actual buffer // count to be |numOutputBuffers|. void initPorts(OMX_U32 numMinInputBuffers, OMX_U32 numInputBuffers, OMX_U32 inputBufferSize, OMX_U32 numMinOutputBuffers, OMX_U32 numOutputBuffers, const char *mimeType, OMX_U32 minCompressionRatio = 1u); virtual void updatePortDefinitions(bool updateCrop = true, bool updateInputSize = false); uint32_t outputBufferWidth(); Loading Loading
include/media/stagefright/ACodec.h +4 −0 Original line number Diff line number Diff line Loading @@ -371,6 +371,10 @@ private: int32_t width, int32_t height, OMX_VIDEO_CODINGTYPE compressionFormat, float frameRate = -1.0); // sets |portIndex| port buffer numbers to be |bufferNum|. NOTE: Component could reject // this setting if the |bufferNum| is less than the minimum buffer num of the port. status_t setPortBufferNum(OMX_U32 portIndex, int bufferNum); // gets index or sets it to 0 on error. Returns error from codec. status_t initDescribeColorAspectsIndex(); Loading
media/libstagefright/ACodec.cpp +41 −0 Original line number Diff line number Diff line Loading @@ -3146,6 +3146,29 @@ static status_t GetMimeTypeForVideoCoding( return ERROR_UNSUPPORTED; } status_t ACodec::setPortBufferNum(OMX_U32 portIndex, int bufferNum) { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = portIndex; status_t err; ALOGD("Setting [%s] %s port buffer number: %d", mComponentName.c_str(), portIndex == kPortIndexInput ? "input" : "output", bufferNum); err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { return err; } def.nBufferCountActual = bufferNum; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { // Component could reject this request. ALOGW("Fail to set [%s] %s port buffer number: %d", mComponentName.c_str(), portIndex == kPortIndexInput ? "input" : "output", bufferNum); } return OK; } status_t ACodec::setupVideoDecoder( const char *mime, const sp<AMessage> &msg, bool haveNativeWindow, bool usingSwRenderer, sp<AMessage> &outputFormat) { Loading Loading @@ -3202,6 +3225,24 @@ status_t ACodec::setupVideoDecoder( return err; } // Set the component input buffer number to be |tmp|. If succeed, // component will set input port buffer number to be |tmp|. If fail, // component will keep the same buffer number as before. if (msg->findInt32("android._num-input-buffers", &tmp)) { err = setPortBufferNum(kPortIndexInput, tmp); if (err != OK) return err; } // Set the component output buffer number to be |tmp|. If succeed, // component will set output port buffer number to be |tmp|. If fail, // component will keep the same buffer number as before. if (msg->findInt32("android._num-output-buffers", &tmp)) { err = setPortBufferNum(kPortIndexOutput, tmp); if (err != OK) return err; } int32_t frameRateInt; float frameRateFloat; if (!msg->findFloat("frame-rate", &frameRateFloat)) { Loading
media/libstagefright/StagefrightMetadataRetriever.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,12 @@ static VideoFrame *extractVideoFrame( // TODO: Use Flexible color instead videoFormat->setInt32("color-format", OMX_COLOR_FormatYUV420Planar); // For the thumbnail extraction case, try to allocate single buffer // in both input and output ports. NOTE: This request may fail if // component requires more than that for decoding. videoFormat->setInt32("android._num-input-buffers", 1); videoFormat->setInt32("android._num-output-buffers", 1); status_t err; sp<ALooper> looper = new ALooper; looper->start(); Loading
media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,8 @@ SoftAVC::SoftAVC( mSignalledError(false), mStride(mWidth){ initPorts( kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); 1 /* numMinInputBuffers */, kNumBuffers, INPUT_BUF_SIZE, 1 /* numMinOutputBuffers */, kNumBuffers, CODEC_MIME_TYPE); GETTIME(&mTimeStart, NULL); Loading
media/libstagefright/include/SoftVideoDecoderOMXComponent.h +15 −0 Original line number Diff line number Diff line Loading @@ -76,12 +76,27 @@ protected: virtual int getColorAspectPreference(); // This function sets both minimum buffer count and actual buffer count of // input port to be |numInputBuffers|. It will also set both minimum buffer // count and actual buffer count of output port to be |numOutputBuffers|. void initPorts(OMX_U32 numInputBuffers, OMX_U32 inputBufferSize, OMX_U32 numOutputBuffers, const char *mimeType, OMX_U32 minCompressionRatio = 1u); // This function sets input port's minimum buffer count to |numMinInputBuffers|, // sets input port's actual buffer count to |numInputBuffers|, sets output port's // minimum buffer count to |numMinOutputBuffers| and sets output port's actual buffer // count to be |numOutputBuffers|. void initPorts(OMX_U32 numMinInputBuffers, OMX_U32 numInputBuffers, OMX_U32 inputBufferSize, OMX_U32 numMinOutputBuffers, OMX_U32 numOutputBuffers, const char *mimeType, OMX_U32 minCompressionRatio = 1u); virtual void updatePortDefinitions(bool updateCrop = true, bool updateInputSize = false); uint32_t outputBufferWidth(); Loading