Dear Experts,
My environment: DM8168/SDK Version: VCSDK(based on DVRRDK 2.8).
In my platform, I encoded alsa pcm audio data to aac by RPE method. ( linux alsa audio in -> rpe -> dsp aac encode)
I want to change encode bitrate when encoding audio by using Rpe_control & XDM_SETPARAMS.
But when I call Rpe_control, I will get failed msg.
: Rpe control call XDM_SETPARAMS failed, status: 1
1) Is it possible to set dyncmic aac encoder parameter during aac encoding?
Plz teach me how to set dynamic aac encoder parameter during aac encoding ~
2) Do I need to call Rpe_acquireCallDescriptor?
In below code, if I call Rpe_acquireCallDescriptor,
I will get RPE_E_INVALIDARG(-1002) return value.
What's the root cause of this error?
Below is my function to set aac encoding run time parameter:
Int32 Audio_SetRuntimeAAC(Void * ctxMem,Int32 bitrate)
{
Int32 status = -1;
encContextDsp *ctx;
encContext *handle;
IAUDENC1_Params *encParams;
Rpe_CallDescHandle controlCallDesc = NULL;
IAUDENC1_DynamicParams *encDynParams= NULL ;
IAUDENC1_Status *encStatus= NULL ;
IAUDENC1_Cmd *cmdId= NULL;
OSA_printf("== %s %d == bitrate(%d)\n",__FUNCTION__,__LINE__,bitrate);
handle = ctxMem;
pthread_mutex_lock(&glock);
if(handle)
{
ctx = GET_ENC_INT_STRUCT(handle);
AUDIO_INFO_PRINT ("AUDIO: ENC Handle %X, Int Handle %X\n", (unsigned int) handle, (unsigned int)ctx);
AUDIO_INFO_PRINT("\n\nAUDIO: 111 -> bitrate(%d) , sampleRate(%d)\n\n",
ctx->encDynParams->bitRate, ctx->encDynParams->sampleRate);
#if 0 //--------------------------------
status = Rpe_acquireCallDescriptor (ctx->encClientHandle,
RPE_CALL_DESC_PROCESS, &controlCallDesc,
&cmdId, &encDynParams, &encStatus);
if (RPE_S_SUCCESS != status)
{
AUDIO_ERROR_PRINT ("AUDIO: ENC -> Rpe_acquireCallDescriptor failed, status: %d\n", status);
Rpe_delete(ctx->encClientHandle);
return NULL;
}
#endif //--------------------------------
encParams = &ctx->encParams;
//encDynParams &ctx->encDynParams;
AUDIO_INFO_PRINT("\nAUDIO: ENC -> bitrate %d inputBitsPerSample %d, sampleRate - %d...\n",
encParams->bitRate, encParams->inputBitsPerSample, encParams->sampleRate);
AUDIO_INFO_PRINT("\nAUDIO: Dyna -> bitrate(%d) , sampleRate(%d)\n",
ctx->encDynParams->bitRate, ctx->encDynParams->sampleRate);
/*--------------------------------------------------------------------*/
/* Set AAC encoder run time parameters */
/*--------------------------------------------------------------------*/
*(ctx->cmdId) = XDM_SETPARAMS;
ctx->encDynParams->bitRate = bitrate;
ctx->encDynParams->size = sizeof (IAUDENC1_DynamicParams);
ctx->encStatus->size = sizeof (IAUDENC1_Status);
status = Rpe_control (ctx->encControlCallDesc);
if (RPE_S_SUCCESS != status)
{
AUDIO_ERROR_PRINT ("\n\n AUDIO: ENC -> Rpe control call XDM_SETPARAMS failed, status: %d\n\n", status);
Rpe_delete(ctx->encClientHandle);
return NULL;
}
}
pthread_mutex_unlock(&glock);
return status;
}
thx ~
HB