No Data Copied When Using Ethernet #1910
-
Hi everyone, I'm trying to get the streams-eth_url_mp3_helix-i2si example working. I enabled #define USE_Ethernet and disabled #define USE_Wifi. However, while everything seems to initialize correctly, no audio data is copied—StreamCopy::copy keeps returning 0 bytes. What Works Setup Observations Question Thanks in advance! #include "AudioTools.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
#include <SPI.h>
#include <EthernetENC.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
const int CS = SS;
EthernetClient eth;
URLStream url(eth);
I2SStream i2s; // final output of decoded stream
EncodedAudioStream dec(&i2s, new MP3DecoderHelix()); // Decoding stream
StreamCopy copier(dec, url); // copy url to decoder
void setupEthernet() {
Ethernet.init(CS);
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac)) {
Serial.print(" DHCP assigned IP ");
Serial.println(Ethernet.localIP());
} else {
Serial.println("Failed to configure Ethernet using DHCP");
stop();
}
}
void setup(){
Serial.begin(115200);
delay(5000);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
setupEthernet();
auto config = i2s.defaultConfig(TX_MODE);
config.pin_ws = 9;
config.pin_bck = 11;
config.pin_data = 12;
i2s.begin(config);
dec.begin();
url.begin("http://stream.srg-ssr.ch/m/rsj/mp3_128","audio/mp3");
}
void loop(){
copier.copy();
}} Logs : Initialize Ethernet with DHCP:
DHCP assigned IP 192.168.178.78
[I] AudioTypes.h : 130 - out: sample_rate: 44100 / channels: 2 / bits_per_sample: 16
[I] AudioTypes.h : 130 - sample_rate: 44100 / channels: 2 / bits_per_sample: 16
[I] I2SConfigESP32.h : 80 - rx/tx mode: TX_MODE
[I] I2SConfigESP32.h : 81 - port_no: 0
[I] I2SConfigESP32.h : 82 - is_master: Master
[I] I2SConfigESP32.h : 83 - sample rate: 44100
[I] I2SConfigESP32.h : 84 - bits per sample: 16
[I] I2SConfigESP32.h : 85 - number of channels: 2
[I] I2SConfigESP32.h : 86 - signal_type: Digital
[I] I2SConfigESP32.h : 88 - i2s_format: I2S_STD_FORMAT
[I] I2SConfigESP32.h : 90 - auto_clear: true
[I] I2SConfigESP32.h : 92 - use_apll: true
[I] I2SConfigESP32.h : 97 - buffer_count:6
[I] I2SConfigESP32.h : 98 - buffer_size:512
[I] I2SConfigESP32.h : 103 - pin_bck: 11
[I] I2SConfigESP32.h : 105 - pin_ws: 9
[I] I2SConfigESP32.h : 107 - pin_data: 12
[I] URLStream.h : 83 - virtual bool audio_tools::URLStream::begin(const char*, const char*, MethodID, const char*, const char*): http://stream.srg-ssr.ch/m/rsj/mp3_128
[I] Url.h : 58 - Url::parse
[I] Url.h : 96 - url->http://stream.srg-ssr.ch/m/rsj/mp3_128
[I] Url.h : 97 - host->stream.srg-ssr.ch
[I] Url.h : 98 - protocol->http
[I] Url.h : 99 - path->/m/rsj/mp3_128
[I] Url.h : 100 - port->80
[I] HttpRequest.h : 238 - process connecting to host stream.srg-ssr.ch port 80
[I] HttpRequest.h : 365 - is connected true with timeout 60000
[I] HttpRequest.h : 249 - Free heap: 327344
[I] HttpHeader.h : 276 - HttpHeader::write
[I] HttpHeader.h : 421 - -> GET /m/rsj/mp3_128 HTTP/1.1
[I] HttpHeader.h : 210 - -> Host: stream.srg-ssr.ch
[I] HttpHeader.h : 210 - -> Connection: keep-alive
[I] HttpHeader.h : 210 - -> Accept-Encoding: identity
[I] HttpHeader.h : 210 - -> Accept: audio/mp3
[I] HttpHeader.h : 342 - -> <CR LF>
[I] HttpRequest.h : 314 - Request written ... waiting for reply
[I] HttpHeader.h : 244 - Waiting for data...
[I] HttpHeader.h : 253 - Data available: 512
[I] HttpRequest.h : 182 - no CONTENT_LENGTH found in reply
[I] URLStream.h : 91 - size: 0
[I] URLStream.h : 98 - ==> http status: 200
[I] StreamCopy.h : 168 - StreamCopy::copy 1024 -> 15 -> 15 bytes - in 1 hops
[I] StreamCopy.h : 168 - StreamCopy::copy 1024 -> 0 -> 0 bytes - in 0 hops
[I] StreamCopy.h : 168 - StreamCopy::copy 1024 -> 0 -> 0 bytes - in 0 hops
[I] StreamCopy.h : 168 - StreamCopy::copy 1024 -> 0 -> 0 bytes - in 0 hops
[I] StreamCopy.h : 168 - StreamCopy::copy 1024 -> 0 -> 0 bytes - in 0 hops
[I] StreamCopy.h : 168 - StreamCopy::copy 1024 -> 0 -> 0 bytes - in 0 hops |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Did you try to do some basic tests with your Ethernet Library: it seems that read() method does not return the requested data... You could also try to to call setCheckAvailable(true) on the copier to call available() automatically to check if there is any data |
Beta Was this translation helpful? Give feedback.
Did you try to do some basic tests with your Ethernet Library: it seems that read() method does not return the requested data...
You could also try to to call setCheckAvailable(true) on the copier to call available() automatically to check if there is any data