MP3_DECODER: Allocate decoder buffer failed

Raffneck
Posts: 2
Joined: Sun Jan 12, 2020 5:52 pm

MP3_DECODER: Allocate decoder buffer failed

Postby Raffneck » Thu Apr 28, 2022 10:05 am

We recently upgraded a project for the ESP32
from IDF v3.3.5 and ADF v2.0
to IDF v4.4 and ADF v2.4

In the project a SSL connection and a audio player is used.
Unfortunatly since the upgrade we get a allocation error after a while when the SSL Connection is still active.

The main problem is that the mp3_decoder reallocates the memory evertime the pipeline is restarted.
This was not the case in the old version, we could not detect any reallocation there.
[The relinking part in the code below is only called on startup]

We were not able to set the mp3_decoder so that it keeps its buffer and does not free and reallocate it.
Is there a way to fix the buffer for the mp3_decoder and reuse it without reallocating it everytime?
It seems that the decoder has a different allocation routine sometimes
because the available heap size varies after the call to run the pipeline.

This is the code we use to restart the pipeline:
  1.    //Stop the current playing
  2.     audio_pipeline_stop(pipeline);
  3.     audio_pipeline_wait_for_stop(pipeline);
  4.    
  5.    //Relink if the mapping changed
  6.    //Which is only the case in the first call
  7.     if (relink)
  8.     {
  9.  
  10.         audio_pipeline_terminate_with_ticks(pipeline, portMAX_DELAY);
  11.         audio_pipeline_remove_listener(pipeline);
  12.         audio_pipeline_unlink(pipeline);
  13.         audio_pipeline_link(pipeline, mapping, 4);
  14.         audio_pipeline_set_listener(pipeline, evt);
  15.     }
  16.  
  17.  
  18.     audio_element_set_uri(AddSource, uri);
  19.  
  20.    //Resetting state
  21.     audio_pipeline_reset_ringbuffer(pipeline);
  22.     audio_pipeline_reset_elements(pipeline);
  23.     audio_pipeline_change_state(pipeline, AEL_STATE_INIT);
  24.  
  25.     //Starting pipe
  26.     audio_pipeline_run(pipeline);

Who is online

Users browsing this forum: No registered users and 15 guests