__pOutBuf = new (std::nothrow) byte[DEFAULT_BUFFER_SIZE];
SysTryCatch(NID_MEDIA, __pOutBuf != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
-
+ "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
return r;
srcBufUsed = res; //Input bytes used
}
- if (gotFrame)
- {
- outBufSize = av_samples_get_buffer_size(NULL, __pCodecCtx->channels, pOutFrame->nb_samples, __pCodecCtx->sample_fmt, 1);
+ outBufSize = av_samples_get_buffer_size(NULL, __pCodecCtx->channels, pOutFrame->nb_samples, __pCodecCtx->sample_fmt, 1);
- SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
+ SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
- dstBufUsed = outBufSize; // The decoded audio data size
- memcpy(pDstBuf, pOutFrame->data[0], outBufSize);
- }
- else
- {
- dstBufUsed = 0;
- }
+ dstBufUsed = outBufSize; // The decoded audio data size
+ memcpy(pDstBuf, pOutFrame->data[0], outBufSize);
__decodeCalled = true;
+
return E_SUCCESS;
}
int samples = 0;
int minSrcBufLength = 0;
int minDstBufLength = FF_MIN_BUFFER_SIZE;
- AVPacket outPacket;
- outPacket.data = null;
int gotOutput = 0;
+ AVPacket outPacket;
SysTryReturnResult(NID_MEDIA, __pCodecCtx, E_INVALID_STATE, "not constructed");
av_init_packet(&outPacket);
outPacket.data = NULL;
outPacket.size = 0;
+ outPacket.priv = NULL;
res = avcodec_encode_audio2(__pCodecCtx, &outPacket, __pInputFrame, &gotOutput);