diff options
author | Ronghua Wu <ronghuawu@google.com> | 2015-03-09 16:26:30 -0700 |
---|---|---|
committer | Ronghua Wu <ronghuawu@google.com> | 2015-03-12 11:37:39 -0700 |
commit | 8b806ea894ca098366629458bfdd1df4866afcdf (patch) | |
tree | b5816f654ec122ac699cefe481c36bfc2db6e125 | |
parent | 2129895bac582be50d3fe067bd5cf5a088863b3a (diff) | |
download | frameworks_av-8b806ea894ca098366629458bfdd1df4866afcdf.zip frameworks_av-8b806ea894ca098366629458bfdd1df4866afcdf.tar.gz frameworks_av-8b806ea894ca098366629458bfdd1df4866afcdf.tar.bz2 |
libstagefright: handle MediaFormat "priority" key.
Bug: 19620911
Change-Id: I73675c7cc3d742b9a1a98d6c0f48dcf17557e2ad
-rw-r--r-- | include/media/stagefright/ACodec.h | 2 | ||||
-rw-r--r-- | media/libstagefright/ACodec.cpp | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index 442c861..aa91485 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -299,6 +299,8 @@ private: status_t setupRawAudioFormat( OMX_U32 portIndex, int32_t sampleRate, int32_t numChannels); + status_t setPriority(int32_t priority); + status_t setMinBufferSize(OMX_U32 portIndex, size_t size); status_t setupMPEG4EncoderParameters(const sp<AMessage> &msg); diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index c75d4df..31e10ce 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -1676,6 +1676,11 @@ status_t ACodec::configureCodec( err = setMinBufferSize(kPortIndexInput, 8192); // XXX } + int32_t priority; + if (msg->findInt32("priority", &priority)) { + err = setPriority(priority); + } + mBaseOutputFormat = outputFormat; CHECK_EQ(getPortFormat(kPortIndexInput, inputFormat), (status_t)OK); @@ -1686,6 +1691,22 @@ status_t ACodec::configureCodec( return err; } +status_t ACodec::setPriority(int32_t priority) { + if (priority < 0) { + return BAD_VALUE; + } + OMX_PARAM_U32TYPE config; + InitOMXParams(&config); + config.nU32 = (OMX_U32)priority; + status_t temp = mOMX->setConfig( + mNode, (OMX_INDEXTYPE)OMX_IndexConfigPriority, + &config, sizeof(config)); + if (temp != OK) { + ALOGI("codec does not support config priority (err %d)", temp); + } + return OK; +} + status_t ACodec::setMinBufferSize(OMX_U32 portIndex, size_t size) { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); |