Solved
OPUS EXAMPLE
i have compiled opus lib on H5. but i can not decode data.
this is my init function and works fine.
DecConfigOpus.channels = 2;
DecConfigOpus.ms_frame = 20;
DecConfigOpus.sample_freq = 48000;
uint32_t dec_size = DEC_Opus_getMemorySize(&DecConfigOpus);
DecConfigOpus.pInternalMemory = (uint8_t *)malloc(dec_size);
int opus_err;
if (DEC_Opus_Init(&DecConfigOpus, &opus_err) != OPUS_SUCCESS)
{
printf("ERROR! DEC_Opus_Init()\r\n");
break;
}and in decode function first time return 960 and then -4.
int packetSize = 80; // Adjust based on your actual packet size
for (int i = 0; i < sizeof(music); i += packetSize)
{
int x = DEC_Opus_Decode((uint8_t*)&music[i], packetSize, DecConfigOpus.pInternalMemory);
if (x < 0)
{
printf("Error decoding packet at index %d: %d\n", i, x);
break; // Exit the loop or handle error as appropriate
}
else
{
printf("Decoded packet at index %d, x = %d\n", i, x);
}
}