espressif / esp-adf-libs

61 stars 41 forks source link

OpenSource #12

Open hpfmn opened 4 years ago

hpfmn commented 4 years ago

Hi, would it be possible to open source these libraries? It is really hard to get it work otherwise because I don't understand what is happening if something fails. For example the opus encoder stack overflows when I'm using two channels and in general something seems wrong when using 48kHz sampling rate and 32bit pcm data. I guess everything expects 44.1kHz@16bits?

And I don't think you'll show to much IP-Stuff, since it seems you're mostly using opensource libs anyway.

Kind regards, Johannes

NikkSaan commented 4 years ago

Yes, please! I'm having all sorts of problems too. If I had to write abstractions myself, it would defeat the purpose of using the ADF..

douardda commented 3 years ago

Same here

douardda commented 3 years ago

would it be possible to have responses here? @jason-mao? I am stuck with an opus decoder that refuses to produce any sound from my stream, how am I supposed to debug this?

Yohannfra commented 3 years ago

would it be possible to have responses here? @jason-mao? I am stuck with an opus decoder that refuses to produce any sound from my stream, how am I supposed to debug this?

Hello @douardda I'm having the same issue with the opus decoder, did you find any solution ?

jason-mao commented 3 years ago

Hi guys, sorry for missing, esp-adf-libs issues not have track on internal. Firstly, I think the most important thing is to solve the problems you have encountered. Regardless of bug, optimize speed and memory, we are happy to solve them. So, @douardda @Yohannfra Would you please provide more details description for your issue at esp-adf issue?

Yohannfra commented 3 years ago

Hello @jason-mao thanks for answering, I have two main issues with esp_audio.

  1. opus decoder doesn't seems to work

in the code I have

    mp3_decoder_cfg_t mp3_dec_cfg = DEFAULT_MP3_DECODER_CONFIG();
    mp3_dec_cfg.task_core = 1;

    wav_decoder_cfg_t wav_dec_cfg = DEFAULT_WAV_DECODER_CONFIG();
    wav_dec_cfg.task_core = 1;

    opus_decoder_cfg_t opus_dec_cfg = DEFAULT_OPUS_DECODER_CONFIG();
    opus_dec_cfg.task_core = 1;

    esp_audio_codec_lib_add(_player->handle, AUDIO_CODEC_TYPE_DECODER, mp3_decoder_init(&mp3_dec_cfg));
    esp_audio_codec_lib_add(_player->handle, AUDIO_CODEC_TYPE_DECODER, wav_decoder_init(&wav_dec_cfg));
    esp_audio_codec_lib_add(_player->handle, AUDIO_CODEC_TYPE_DECODER, decoder_opus_init(&opus_dec_cfg));

And after that when I try to play a mp3 or wav file it works but when I try an opus one nothing happens.

  1. I'm working on an application that uses a lot of memory and stack so I run it in a task that I create like that
xTaskCreate(mytask, "mytask", 100000, NULL, 1, NULL);

and if I call esp_audio_play from within this task it fails to create the audio task and the audio doesn't play and gives me this error in the logs

Capture d’écran 2021-05-18 à 09 57 16

Thanks,

jason-mao commented 3 years ago

@Yohannfra Did you use SPI RAM for you project? As your problems, they are exhaust the DRAM memory. MP3 and WAV memory less than OPUS, so they works well.

Yohannfra commented 3 years ago

@Yohannfra Did you use SPI RAM for you project? As your problems, they are exhaust the DRAM memory. MP3 and WAV memory less than OPUS, so they works well.

Yes I use it and applied the esp-idf patch for freertos tasks ( esp-adf/idf_patches/idf_v3.3_freertos.patch).

Do you mean that opus uses more memory and that's why it does't work ?

jason-mao commented 3 years ago

@Yohannfra Did you use SPI RAM for you project? As your problems, they are exhaust the DRAM memory. MP3 and WAV memory less than OPUS, so they works well.

Yes I use it and applied the esp-idf patch for freertos tasks ( esp-adf/idf_patches/idf_v3.3_freertos.patch).

Do you mean that opus uses more memory and that's why it does't work ?

Yes, even opus consumes more memory than MP3, the cli example can be works well. We don't recommend that any task create by a lot of stack size. Would you show me that memory free size when you get fail?

Yohannfra commented 3 years ago

@Yohannfra Did you use SPI RAM for you project? As your problems, they are exhaust the DRAM memory. MP3 and WAV memory less than OPUS, so they works well.

Yes I use it and applied the esp-idf patch for freertos tasks ( esp-adf/idf_patches/idf_v3.3_freertos.patch). Do you mean that opus uses more memory and that's why it does't work ?

Yes, even opus consumes more memory than MP3, the cli example can be works well. We don't recommend that any task create by a lot of stack size. Would you show me that memory free size when you get fail?

How do you show memory free size ? with esp_get_free_heap_size() ?

jason-mao commented 3 years ago

@Yohannfra Did you use SPI RAM for you project? As your problems, they are exhaust the DRAM memory. MP3 and WAV memory less than OPUS, so they works well.

Yes I use it and applied the esp-idf patch for freertos tasks ( esp-adf/idf_patches/idf_v3.3_freertos.patch). Do you mean that opus uses more memory and that's why it does't work ?

Yes, even opus consumes more memory than MP3, the cli example can be works well. We don't recommend that any task create by a lot of stack size. Would you show me that memory free size when you get fail?

How do you show memory free size ? with esp_get_free_heap_size() ?

Please refer to AUDIO_MEM_SHOW() in audio_mem.h

Yohannfra commented 3 years ago

@jason-mao And where should I call it since the crash occures in esp_audio_play ?

Thanks for you answers and help.

jason-mao commented 3 years ago

@jason-mao And where should I call it since the crash occures in esp_audio_play ?

Thanks for you answers and help.

Failed to call esp_audio_play, or create AUDIO_THREAD failed is ok.

NikkSaan commented 2 years ago

Hi guys, sorry for missing, esp-adf-libs issues not have track on internal. Firstly, I think the most important thing is to solve the problems you have encountered. Regardless of bug, optimize speed and memory, we are happy to solve them. So, @douardda @Yohannfra Would you please provide more details description for your issue at esp-adf issue?

You think wrong!! The most important thing is to give us the source so we can deal with our own problems instead of waiting for you to fix it.. mp4 is still a mess! some tracks play, others don't. memory leaks all over the place when using esp_audio... just to name a few.. And even if it had no bugs working in the dark is impossible!! GIVE US THE SOURCE!

expresspotato commented 2 years ago

Yes I 2nd this completely. It's really hard to debug the libs without breakpoints or print statements... How come they're not open source? Most of the implementations in it anyways already make use of open source libs so it's not like there is some real competitive advantage to keeping this repo closed source.

maowen commented 1 year ago

Here is an open port of libopus for the ESP-IDF in case it is helpful: https://github.com/XasWorks/esp-libopus

tdVincentB commented 11 months ago

Hi guys, sorry for missing, esp-adf-libs issues not have track on internal. Firstly, I think the most important thing is to solve the problems you have encountered. Regardless of bug, optimize speed and memory, we are happy to solve them. So, @douardda @Yohannfra Would you please provide more details description for your issue at esp-adf issue?

Sorry to stray from libopus for one second and focus back on the main thread about open sourcing libraries, especially after this comment from @jason-mao about esp-adf-libs not having internal track...

Like @hpfmn I am also in favor of open sourcing libraries, especially if they are not tracked actively at Expressif.

One other example where Expressif not sharing source code poses real word issues is the SIP protocol in esp_rtc

SIP for VoIP calls works but is extremely limited right now, lacking much of the standard features. The "MESSAGE" type for instance is crucial for certain widely used alarm protocols like SCAIP. It is impossible to use your library just because of this one missing type...and one must rewrite a whole SIP stack just for this.

If the esp-adf-libs is not tracked or updated internally, please consider open sourcing some of the libraries because of these very real limitations. Or at the bare minimum regarding the SIP stack, at least please provide a way for users to expand your library by sending their own standard SIP requests) and handling the corresponding responses.