play_mp3_rates example error messages

redpanda
Posts: 13
Joined: Thu Feb 04, 2021 8:42 am

play_mp3_rates example error messages

Postby redpanda » Thu Feb 04, 2021 8:52 am

I am playing around with some examples of ESP-ADF.

For examples, in case of play_mp3_rates sample code, it runs as expected except I often see error messages during playback below (those lines starting with letter E):

Code: Select all

I (535) PLAY_MP3_RATES: [ 1 ] Start audio codec chip
I (565) PLAY_MP3_RATES: [ 2 ] Create audio pipeline, add all elements to pipeline, and subscribe pipeline event
I (565) PLAY_MP3_RATES: [2.1] Create mp3 decoder to decode mp3 file and set custom read callback
I (575) PLAY_MP3_RATES: [2.2] Create i2s stream to write data to codec chip
I (605) PLAY_MP3_RATES: [2.3] Register all elements to audio pipeline
I (605) PLAY_MP3_RATES: [2.4] Link it together [mp3_music_read_cb]-->mp3_decoder-->i2s_stream-->[codec_chip]
I (615) PLAY_MP3_RATES: [ 3 ] Set up  event listener
I (615) PLAY_MP3_RATES: [3.1] Listening event from all elements of pipeline
I (625) PLAY_MP3_RATES: [ 4 ] Start audio_pipeline
I (635) PLAY_MP3_RATES: [ * ] Receive music info from mp3 decoder, sample_rates=8000, bits=16, ch=2
E (19145) AUDIO_ELEMENT: [mp3] Element already stopped
E (19145) AUDIO_ELEMENT: [i2s] Element already stopped
I (19155) PLAY_MP3_RATES: [ * ] Receive music info from mp3 decoder, sample_rates=22050, bits=16, ch=2
E (19325) PLAY_MP3_RATES: [ * ] Event interface error : -1
E (19325) PLAY_MP3_RATES: [ * ] Event interface error : -1
E (37535) AUDIO_ELEMENT: [mp3] Element already stopped
E (37535) AUDIO_ELEMENT: [i2s] Element already stopped
I (37545) PLAY_MP3_RATES: [ * ] Receive music info from mp3 decoder, sample_rates=44100, bits=16, ch=2
E (37635) PLAY_MP3_RATES: [ * ] Event interface error : -1
E (37635) PLAY_MP3_RATES: [ * ] Event interface error : -1
E (55765) AUDIO_ELEMENT: [mp3] Element already stopped
E (55765) AUDIO_ELEMENT: [i2s] Element already stopped[/color]
I (55775) PLAY_MP3_RATES: [ * ] Receive music info from mp3 decoder, sample_rates=8000, bits=16, ch=2
How can I code to avoid such error messages? or they simply can be ignored? Any recommendation?

ssjboard
Posts: 1
Joined: Sat Oct 23, 2021 8:34 am

Re: play_mp3_rates example error messages

Postby ssjboard » Sat Oct 23, 2021 8:37 am

  1. HI, any update on the same?

bs-eng
Posts: 20
Joined: Wed Oct 28, 2020 8:19 pm

Re: play_mp3_rates example error messages

Postby bs-eng » Tue Oct 26, 2021 1:39 pm

Hi there!

I am observing the same issue in my application.

The root cause is that the pipeline handler tries to stop audio elements that already stopped - for example because the fatfs reader has finished reading file-data long before the i2s-writer has finished sendign audio-data to the codec chip. As long as the last element is still in state RUNNING, it seems the pipeline itself is still in state RUNNING too.
This is the case in the example code on line 150 - it attempts to stop the pipeline even though the i2s_stream_writer is already in state AEL_STATUS_STATE_FINISHED:

Code: Select all

if (msg.source_type == AUDIO_ELEMENT_TYPE_ELEMENT && msg.source == (void *) i2s_stream_writer
            && msg.cmd == AEL_MSG_CMD_REPORT_STATUS
            && (((int)msg.data == AEL_STATUS_STATE_STOPPED) || ((int)msg.data == AEL_STATUS_STATE_FINISHED))) {
            audio_pipeline_stop(pipeline);            // <=== here it tries to stop even though state is Stopped or Finished
            audio_pipeline_wait_for_stop(pipeline);
            audio_pipeline_terminate(pipeline);
            audio_pipeline_reset_ringbuffer(pipeline);
            audio_pipeline_reset_elements(pipeline);
            set_next_file_marker();
            audio_pipeline_run(pipeline);
        }
For me this creates a lot of problems, because I use the AEL_MSG_CMD_REPORT_STATUS to get notified about state changes of each audio element.

Now I wonder whether it is indeed an error if an audio element is being stopped even though it is already in a state like FINISHED or STOPPED or ABORTED?
Or can we safely ignore these errors?

Can one of the Espressif people help out with info here?

Thanks a lot!
Cheers
JR

Who is online

Users browsing this forum: No registered users and 8 guests