Skip to content

The player-url-u2s example breaks if you swap mp3 for AAC, while including A2DP #2106

@Jakobohrnell

Description

@Jakobohrnell

Problem Description

As the title states, if I change the decoder and format for AAC and include A2DP, without calling it, the web streams no longer work. The below example code will not, for me, work unless you comment out #include "BluetoothA2DPSink.h". If you comment it out, it works as expected. And if you include A2DPSink in the unmodified example code which uses mp3 it also works fine.

It compiles and flashes fine, but it will just time out on all the web streams and try to play 0 bytes of data.

Device Description

ESP32-WROVER

Sketch

#include "AudioTools.h"
#include "AudioTools/AudioCodecs/CodecAACHelix.h"
#include "AudioTools/Disk/AudioSourceURL.h"
#include "BluetoothA2DPSink.h"


const char *urls[] = {
  "https://lyd.nrk.no/icecast/aac/high/s0w7hwn47m/p1_dk3",
  "https://lyd.nrk.no/icecast/aac/high/s0w7hwn47m/mp3",
  "https://live1.sr.se/p1-aac-320",
  "https://live1.sr.se/p3-aac-320",
  "https://streams.fluxfm.de/Chillhop/aac-64/streams.fluxfm.de/"
};
const char *wifi = "SSID";
const char *password = "PASSWORD";

URLStream urlStream(wifi, password);
AudioSourceURL source(urlStream, urls, "audio/aac");
I2SStream i2s;
AACDecoderHelix decoder;
AudioPlayer player(source, i2s, decoder);

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

  auto cfg = i2s.defaultConfig(TX_MODE);
  i2s.begin(cfg);

  player.begin();
}

void loop() {
  player.copy();
}

Other Steps to Reproduce

No response

What is your development environment (incl. core version info)

Arduino IDE v2, latest audio tools and A2DP

I have checked existing issues, discussions and online documentation

  • I confirm I have checked existing issues, discussions and online documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions