We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#旧接口--可正常使用 DPRCT_W virtual int encode(const void* inputBuf, unsigned int inputLen, void* outputBuf, unsigned int outputLen) = 0; # 新接口---编码H264异常 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已经正常分配内存.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
背景
使用上述接口编码NV12->H264. 可以正常工作. 但根据官方提示, 该接口已废弃. 推荐使用新的接口
新接口代码演示
替换使用新的接口, 编码第二帧数据的时候, 编码器内部一直提示一下错误
编码器内部报错
根据提示信息大意为未分配内存. 但实际输入的avpacket已经正常分配内存.
1. 这个问题是SDKbug? 还是外部接口调用需要修改?
2. 官方提供的是一个jpg编码的demo, 能否提供一个H264编码的用法?
The text was updated successfully, but these errors were encountered: