CTS 问题 第三篇

1、
android.media.cts.MediaCodecCapabilitiesTest
– testGetMaxSupportedInstances

fail:
unit.framework.AssertionFailedError: Got unexpected IllegalArgumentException start failed at junit.framework.Assert.fail(Assert.java:50) 

step 1:
路径:idh.code/device/sprd/scx20/common/rootdir/system/etc/media_codecs.xml

@@ -115,7 +115,7 @@ Only the three quirks included above are recognized at this point:
             <Limit name="block-size" value="16x16" />
             <Limit name="blocks-per-second" range="1-245760" />
             <Limit name="bitrate" range="1-50000000" />
-            <Limit name="concurrent-instances" max="16" />
+            <Limit name="concurrent-instances" max="12" />
             <Feature name="adaptive-playback" />
         </MediaCodec>
         <MediaCodec name="OMX.sprd.vpx.decoder" type="video/x-vnd.on2.vp8">
@@ -126,6 +126,7 @@ Only the three quirks included above are recognized at this point:
             <Limit name="block-size" value="16x16" />
             <Limit name="blocks-per-second" range="1-245760" />
             <Limit name="bitrate" range="1-40000000" />
+                       <Limit name="concurrent-instances" max="16" /> 
             <Feature name="adaptive-playback" />
         </MediaCodec>
         <!-- C&M Supported decoder BEGIN-->

step 2:
路径:
idh.code/vendor/sprd/open-source/libs/omx_components/video
/avc_sprd/sc8830/dec/SPRDAVCDecoder.cpp

@@ -40,7 +40,7 @@

 namespace android {

-#define MAX_INSTANCES 16
+#define MAX_INSTANCES 12
 static int instances = 0;
 const static int64_t kConditionEventTimeOutNs = 3000000000LL;

step 3:
路径:
idh.code/vendor/sprd/open-source/libs/omx_components/video/
vpx_sprd/sc8830/dec/SPRDVPXDecoder.cpp

@@ -39,6 +39,10 @@ namespace android {

 const static int64_t kConditionEventTimeOutNs = 3000000000LL;

+#define MAX_VPX_INSTANCES 16
+
+static int vpx_instances = 0;
+
 template<class T>
 static void InitOMXParams(T *params) {
     params->nSize = sizeof(T);
@@ -91,7 +95,9 @@ SPRDVPXDecoder::SPRDVPXDecoder(
       mVPXDecGetLastDspFrm(NULL),
       mVPXGetCodecCapability(NULL) {

-    ALOGI("Construct SPRDVPXDecoder, this: %p", (void *)this);
+    ALOGI("Construct SPRDVPXDecoder, this: %p, instances: %d", (void *)this, vpx_instances);
+
+    mInitCheck = OMX_ErrorNone;

     initPorts();
     CHECK_EQ(openDecoder("libomx_vpxdec_hw_sprd.so"), true);
@@ -105,15 +111,24 @@ SPRDVPXDecoder::SPRDVPXDecoder(
     }
     ALOGI("%s, is IOMMU enabled: %d, ID: %d", __FUNCTION__, mIOMMUEnabled, mIOMMUID);

-    CHECK_EQ(initDecoder(), (status_t)OK);
+    //CHECK_EQ(initDecoder(), (status_t)OK);
+    if(initDecoder() != OK) {
+        mInitCheck = OMX_ErrorInsufficientResources;
+    }

     iUseAndroidNativeBuffer[OMX_DirInput] = OMX_FALSE;
     iUseAndroidNativeBuffer[OMX_DirOutput] = OMX_FALSE;
+
+    vpx_instances++;
+    if (vpx_instances > MAX_VPX_INSTANCES) {
+        ALOGE("instances(%d) are too much, return OMX_ErrorInsufficientResources", vpx_instances);
+        mInitCheck = OMX_ErrorInsufficientResources;
+    }
 }

 SPRDVPXDecoder::~SPRDVPXDecoder() {

-    ALOGI("Destruct SPRDVPXDecoder, this: %p", (void *)this);
+    ALOGI("Destruct SPRDVPXDecoder, this: %p, instances: %d", (void *)this, vpx_instances);

     releaseDecoder();

@@ -130,6 +145,13 @@ SPRDVPXDecoder::~SPRDVPXDecoder() {
         set_ddr_freq("0");
         mSetFreqCount--;
     }
+
+    vpx_instances--;
+}
+
+OMX_ERRORTYPE SPRDVPXDecoder::initCheck() const{
+    ALOGI("%s, mInitCheck: 0x%x", __FUNCTION__, mInitCheck);
+    return mInitCheck;
 }

 void SPRDVPXDecoder::initPorts() {
@@ -282,7 +304,11 @@ status_t SPRDVPXDecoder::initDecoder() {

     uint32_t size_inter = VP8_DECODER_INTERNAL_BUFFER_SIZE;
     mPbuf_inter = (uint8_t *)malloc(size_inter);
-       CHECK(mPbuf_inter != NULL);
+       //CHECK(mPbuf_inter != NULL);
+    if (mPbuf_inter == NULL) {
+        ALOGE("failed to allocate buffer, size: %d", size_inter);
+        return OMX_ErrorInsufficientResources;
+    }

     uint32_t size_extra = 8160*9*8+64;
     size_extra += 10*1024;

step 4:
路径:
idh.code/vendor/sprd/open-source/libs/omx_components/video/
vpx_sprd/sc8830/dec/SPRDVPXDecoder.h

@@ -35,6 +35,8 @@ struct SPRDVPXDecoder : public SprdSimpleOMXComponent {
                    OMX_PTR appData,
                    OMX_COMPONENTTYPE **component);

+    OMX_ERRORTYPE initCheck() const;
+
 protected:
     virtual ~SPRDVPXDecoder();

@@ -137,6 +139,8 @@ private:

     OMX_BOOL iUseAndroidNativeBuffer[2];

+    OMX_ERRORTYPE mInitCheck;
+
     static int32_t BindFrameWrapper(void *aUserData, void *pHeader, int flag);
     static int32_t UnbindFrameWrapper(void *aUserData, void *pHeader, int flag);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值