Skip to content

Unable to stop ICYStream in a multithreaded context #1954

Answered by pschatzmann
vladkorotnev asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure what is going wrong: the following test sketch is working perfectly

#include "AudioTools.h"

void setup(){
  Serial.begin(115200);
  AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);  
}

void loop() {
  Serial.begin(115200);
  Serial.println("---> loop:");
  ICYStream *p_url = new ICYStream("ssid","pwd");  // or replace with ICYStream to get metadata
  if (!p_url->begin("https://stream.srg-ssr.ch/m/rsj/mp3_128","audio/mp3")){
    stop();
  }
  p_url->end();
  delete p_url;

}

I have the following comments though:

  • on microcontrollers avoid to allocate objects dynamically: the best is to allocate them once in the setup or better as global data. You are running the risk of…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vladkorotnev
Comment options

Answer selected by pschatzmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants