Can anyone explain to me the difference between these functions?
audio_pipeline_unlink
audio_pipeline_breakup_elements
audio_pipeline_unlink versus audio_pipeline_breakup_elements
-
- Posts: 125
- Joined: Fri May 24, 2019 2:02 am
-
- Posts: 40
- Joined: Wed Jun 22, 2022 12:10 pm
Re: audio_pipeline_unlink versus audio_pipeline_breakup_elements
audio_pipeline_link is used to connect elements from first one to last one
It allocates ring buffer for data exchange between audio element.
audio_pipeline_unlink do the reverse work, it disconnects elements from each other, and free ringbuffer.
audio_pipeline_breakup_elements just disconnect elements from each other, and keep the allocated ringbuffer.
Afterwards you can add more elements or remove some elements from the pipeline using audio_pipeline_relink
Following code show the usage, it changes the decode element and keep the others unchanged.
It allocates ring buffer for data exchange between audio element.
audio_pipeline_unlink do the reverse work, it disconnects elements from each other, and free ringbuffer.
audio_pipeline_breakup_elements just disconnect elements from each other, and keep the allocated ringbuffer.
Afterwards you can add more elements or remove some elements from the pipeline using audio_pipeline_relink
Following code show the usage, it changes the decode element and keep the others unchanged.
Code: Select all
audio_pipeline_pause(pipeline_play);
ESP_LOGE(TAG, "Changing music to %s", source_is_mp3_format ? "mp3 format" : "aac format");
if (source_is_mp3_format) {
audio_pipeline_breakup_elements(pipeline_play, aac_decoder_el);
audio_pipeline_relink(pipeline_play, (const char *[]) {"file_mp3_reader", "mp3_decoder", "filter_upsample", "i2s_writer"}, 4);
audio_pipeline_set_listener(pipeline_play, evt);
} else {
audio_pipeline_breakup_elements(pipeline_play, mp3_decoder_el);
audio_pipeline_relink(pipeline_play, (const char *[]) {"file_aac_reader", "aac_decoder", "filter_upsample", "i2s_writer"}, 4);
audio_pipeline_set_listener(pipeline_play, evt);
}
audio_pipeline_run(pipeline_play);
audio_pipeline_resume(pipeline_play);
Who is online
Users browsing this forum: No registered users and 28 guests