导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    T5编码H264接口报错

    其它全志芯片讨论区
    1
    2
    1090
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • L
      leohe LV 2 最后由 编辑

      背景

      #旧接口--可正常使用
      DPRCT_W virtual int encode(const void* inputBuf, unsigned int inputLen,
                                     void* outputBuf, unsigned int outputLen) = 0;
      
      # 新接口
      virtual int encode(AVPacket* inPacket) = 0;
      

      使用上述接口编码NV12->H264. 可以正常工作. 但根据官方提示, 该接口已废弃. 推荐使用新的接口

      新接口问题描述

      // init part
      
       if (!m_avPacket )
          {
              m_avPacket = (AVPacket*)calloc(1,sizeof(AVPacket));
              if (!m_avPacket->pAddrVir0)
              {
                  int32_t frameSize = encode_param_.srcW * encode_param_.srcH *1.5;
                  m_avPacket->pAddrVir0 = (unsigned char* )calloc(frameSize, sizeof(int8_t));
                  m_avPacket->pAddrVir1 = m_avPacket->pAddrVir0+ encode_param_.srcW * encode_param_.srcH;
              }    
          }
      
       p_encoder_ = AWVideoEncoder::create();
        p_encoder_->init(&encode_param_,this);
      
      
      int32_t Encoder::EncodeFrame(int8_t *buff, uint32_t buffSize, int64_t pts, int32_t format)
      {
      
          if (buff == NULL || !m_avPacket)
          {
          	PLOGE.printf("raw image data is null and return!\n");
          	return -1;
          }
          static int64_t frameIndex  =0;
          m_avPacket->id = frameIndex ++;
          m_avPacket->pts = pts;
          int32_t frameUint = encode_param_.srcW * encode_param_.srcH ;
          m_avPacket->dataLen0  = frameUint;
          m_avPacket->dataLen1  = frameUint/2;
          memcpy(m_avPacket->pAddrVir0 ,  buff,frameUint*1.5);
          // memcpy(m_avPacket->pAddrVir1 ,  buff+frameUint,frameUint/2);
          int32_t ret =  p_encoder_->encode(m_avPacket);
          LOGI("encode input    pts:%d , index:%d result:%d", buffSize, pts, m_avPacket->id,ret);
          
      }
      

      替换使用新的接口, 编码第二帧数据的时候, 编码器内部一直提示一下错误

      ERROR  : cedarc <ReturnOneAllocateInputBuffer:424>: this buffer isn't allocate buffer,can't return
      ERROR  : cedarc <ReturnOneAllocInputBuffer:390>: ReturnOneAllocInputBuffer failed
      

      根据提示信息大意为未分配内存. 但实际输入的avpacket已经正常分配内存. 这个问题是SDKbug? 还是外部接口调用需要修改?

      1 条回复 最后回复 回复 引用 分享 0
      • L
        leohe LV 2 最后由 编辑

        问题

        能够提供一个H264 新接口的编码DEMO ?

        1 条回复 最后回复 回复 引用 分享 0
        • 1 / 1
        • First post
          Last post

        Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

        行为准则 | 用户协议 | 隐私权政策