Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding error 0x0235 (bad main_data_begin pointer) at byte offset #9

Closed
gerardwr opened this issue Nov 18, 2017 · 101 comments
Closed

Decoding error 0x0235 (bad main_data_begin pointer) at byte offset #9

gerardwr opened this issue Nov 18, 2017 · 101 comments

Comments

@gerardwr
Copy link

gerardwr commented Nov 18, 2017

This looks like an excellent library to stream internet-radio.

The StreamMP3FromHTTP sketch compiles (Arduino 1.8.1 and ESP8266 2.3.0), but with dozens of "red" warnings.

Upload to a Wemos D1 Mini (160Mhz)results in the errors below.

Any suggestions what to do?

�:��������a�����aV������qEc��S�aEc�i...Connecting to WiFi
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 0
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 418
Decoding error 0x0101 (lost synchronization) at byte offset 57774
Decoding error 0x0104 (reserved sample frequency value) at byte offset 58011
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 58097
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 58515
Decoding error 0x0101 (lost synchronization) at byte offset 108874
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 109088
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 109506
Decoding error 0x0101 (lost synchronization) at byte offset 161434
Decoding error 0x0101 (lost synchronization) at byte offset 161467
Decoding error 0x0104 (reserved sample frequency value) at byte offset 161647
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 161751
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 162169
Decoding error 0x0101 (lost synchronization) at byte offset 209614
Decoding error 0x0104 (reserved sample frequency value) at byte offset 209700
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 209816
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 210234
Decoding error 0x0101 (lost synchronization) at byte offset 298674
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 298841
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 299259
Decoding error 0x0101 (lost synchronization) at byte offset 336215
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 336875
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 337293
Decoding error 0x0101 (lost synchronization) at byte offset 380434
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 380761
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 381179
Decoding error 0x0101 (lost synchronization) at byte offset 422774
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 422975
Decoding error 0x0101 (lost synchronization) at byte offset 440918
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 441783
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 442201
Decoding error 0x0101 (lost synchronization) at byte offset 638854
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 639060
@earlephilhower
Copy link
Owner

earlephilhower commented Nov 19, 2017

Howdy,

Can you please post those warnings you're getting? I compile with -Wall and don't get anything in the Audio library (but I do see stuff in SPIFFS and the main ESP arduino libs which I can't touch)...

It looks like things are working fine, you're just losing packets somewhere. The decoder is resyncing and continuing to play from what I can see.

Have you tried adding a buffer between the HTTPStream and the Generator? The README.md shows a simple example...as long as you have memory it's literally a 1-2 line change.

Here's all I get on a clean compile w/-Wall using the latest Arduino and ESP8266Audio Git:

/home/earle/Arduino/libraries/ESP8266Audio/src/AudioGeneratorAAC.cpp: In member function 'virtual bool AudioGeneratorAAC::loop()':
/home/earle/Arduino/libraries/ESP8266Audio/src/AudioGeneratorAAC.cpp:108:69: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     if (ret = AACDecode(hAACDecoder, &inBuff, &bytesLeft, outSample)) {
                                                                     ^
/home/earle/Arduino/libraries/ESP8266Audio/src/AudioGeneratorAAC.cpp:115:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (fi.sampRateOut != lastRate) {
                             ^
/home/earle/Arduino/libraries/ESP8266Audio/src/libhelix-aac/dequant.c: In function 'raac_DeinterleaveShortBlocks':
/home/earle/Arduino/libraries/ESP8266Audio/src/libhelix-aac/dequant.c:367:41: warning: unused parameter 'aacDecInfo' [-Wunused-parameter]
 int DeinterleaveShortBlocks(AACDecInfo *aacDecInfo, int ch)
                                         ^
/home/earle/Arduino/libraries/ESP8266Audio/src/libhelix-aac/dequant.c:367:57: warning: unused parameter 'ch' [-Wunused-parameter]
 int DeinterleaveShortBlocks(AACDecInfo *aacDecInfo, int ch)

@earlephilhower
Copy link
Owner

And, as I felt bad having them hanging around, I just cleared up those 4 warnings with the latest push. No functional changes, just stuff to make GCC happy.

@gerardwr
Copy link
Author

Thanks for your response, is appreciated!

The warnings in your post LOOK similar to mine, but I will check in detail later today, and report back. AND I will check the version with the 4 warnings cleared, nice work!

And NO, i didn't try adding a buffer yet, just added my SSID and compiled the standard example sketch.

My turn again, I will report back later. Thx.

@gerardwr
Copy link
Author

These are my warnings with the latest Arduino-ESP8266 GIT and with the former ESP8266Audio GIT:

/Users/gerard/Documents/My Data/ArduinoESP/libraries/ESP8266Audio/src/AudioGeneratorAAC.cpp: In member function 'virtual bool AudioGeneratorAAC::loop()':
/Users/gerard/Documents/My Data/ArduinoESP/libraries/ESP8266Audio/src/AudioGeneratorAAC.cpp:108:69: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     if (ret = AACDecode(hAACDecoder, &inBuff, &bytesLeft, outSample)) {
                                                                     ^
/Users/gerard/Documents/My Data/ArduinoESP/libraries/ESP8266Audio/src/AudioGeneratorAAC.cpp:115:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (fi.sampRateOut != lastRate) {
                             ^
/Users/gerard/Documents/My Data/ArduinoESP/libraries/ESP8266Audio/src/libhelix-aac/dequant.c: In function 'raac_DeinterleaveShortBlocks':
/Users/gerard/Documents/My Data/ArduinoESP/libraries/ESP8266Audio/src/libhelix-aac/dequant.c:367:41: warning: unused parameter 'aacDecInfo' [-Wunused-parameter]
 int DeinterleaveShortBlocks(AACDecInfo *aacDecInfo, int ch)
                                         ^
/Users/gerard/Documents/My Data/ArduinoESP/libraries/ESP8266Audio/src/libhelix-aac/dequant.c:367:57: warning: unused parameter 'ch' [-Wunused-parameter]
 int DeinterleaveShortBlocks(AACDecInfo *aacDecInfo, int ch)
                                                         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp:45:18: warning: unused parameter 'client' [-Wunused-parameter]
     virtual bool verify(WiFiClient& client, const char* host)
                  ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp:45:18: warning: unused parameter 'host' [-Wunused-parameter]
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:233:9: warning: unused parameter 'isLastComponent' [-Wunused-parameter]
 boolean callback_pathExists(SdFile& parentDir, char *filePathComponent, 
         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:233:9: warning: unused parameter 'object' [-Wunused-parameter]
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:311:9: warning: unused parameter 'object' [-Wunused-parameter]
 boolean callback_remove(SdFile& parentDir, char *filePathComponent, 
         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:319:9: warning: unused parameter 'object' [-Wunused-parameter]
 boolean callback_rmdir(SdFile& parentDir, char *filePathComponent, 
         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::readData(uint32_t, uint16_t, uint16_t, uint8_t*)':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/Sd2Card.cpp:396:12: warning: unused variable 'n' [-Wunused-variable]
   uint16_t n;

            ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp: In static member function 'static uint8_t SdFile::make83Name(const char*, uint8_t*)':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp:262:15: warning: unused variable 'b' [-Wunused-variable]
       uint8_t b;

               ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp: In member function 'uint8_t SdFile::rmRfStar()':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp:908:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (curPosition_ != (32*(index + 1))) {

                                        ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c: In function 'SPIFFS_buffer_bytes_for_filedescs':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c:16:49: warning: unused parameter 'fs' [-Wunused-parameter]
 u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) {
                                                 ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp: In member function 'bool EspClass::eraseConfig()':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp:399:10: warning: unused variable 'ret' [-Wunused-variable]
     bool ret = true;
          ^
Archiving built core (caching) in: /var/folders/5l/fjrz26dn5710yvf5hgzlcvsw0000gn/T/arduino_cache_825551/core/core_esp8266com_esp8266_d1_mini_CpuFrequency_160,FlashSize_4M3M,LwIPVariant_open,Debug_Disabled,DebugLevel_None____,UploadSpeed_230400_0a1796809b00622e6557403083020d45.a
De schets gebruikt 397437 bytes (38%)  programma-opslagruimte. Maximum is 1044464 bytes.
Globale variabelen gebruiken 35924 bytes (43%) van het dynamisch geheugen. Resteren 45996 bytes voor lokale variabelen. Maximum is 81920 bytes.
Uploading 401584 bytes from /var/folders/5l/fjrz26dn5710yvf5hgzlcvsw0000gn/T/arduino_build_926479/StreamMP3FromHTTP.ino.bin to flash at 0x00000000
................................................................................ [ 20% ]
................................................................................ [ 40% ]
................................................................................ [ 61% ]
................................................................................ [ 81% ]
.........................................................................        [ 100% ]

@gerardwr
Copy link
Author

These are my warnings with the latest Arduino-ESP8266 GIT and with your latest ESP8266Audio GIT:

/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp:45:18: warning: unused parameter 'client' [-Wunused-parameter]
     virtual bool verify(WiFiClient& client, const char* host)
                  ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp:45:18: warning: unused parameter 'host' [-Wunused-parameter]
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:233:9: warning: unused parameter 'isLastComponent' [-Wunused-parameter]
 boolean callback_pathExists(SdFile& parentDir, char *filePathComponent, 
         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:233:9: warning: unused parameter 'object' [-Wunused-parameter]
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:311:9: warning: unused parameter 'object' [-Wunused-parameter]
 boolean callback_remove(SdFile& parentDir, char *filePathComponent, 
         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/SD.cpp:319:9: warning: unused parameter 'object' [-Wunused-parameter]
 boolean callback_rmdir(SdFile& parentDir, char *filePathComponent, 
         ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::readData(uint32_t, uint16_t, uint16_t, uint8_t*)':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/Sd2Card.cpp:396:12: warning: unused variable 'n' [-Wunused-variable]
   uint16_t n;

            ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp: In static member function 'static uint8_t SdFile::make83Name(const char*, uint8_t*)':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp:262:15: warning: unused variable 'b' [-Wunused-variable]
       uint8_t b;

               ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp: In member function 'uint8_t SdFile::rmRfStar()':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD/src/utility/SdFile.cpp:908:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (curPosition_ != (32*(index + 1))) {

                                        ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c: In function 'SPIFFS_buffer_bytes_for_filedescs':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c:16:49: warning: unused parameter 'fs' [-Wunused-parameter]
 u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) {
                                                 ^
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp: In member function 'bool EspClass::eraseConfig()':
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp:399:10: warning: unused variable 'ret' [-Wunused-variable]
     bool ret = true;
          ^
Archiving built core (caching) in: /var/folders/5l/fjrz26dn5710yvf5hgzlcvsw0000gn/T/arduino_cache_604903/core/core_esp8266com_esp8266_d1_mini_CpuFrequency_160,FlashSize_4M3M,LwIPVariant_open,Debug_Disabled,DebugLevel_None____,UploadSpeed_230400_0a1796809b00622e6557403083020d45.a
De schets gebruikt 397437 bytes (38%)  programma-opslagruimte. Maximum is 1044464 bytes.
Globale variabelen gebruiken 35924 bytes (43%) van het dynamisch geheugen. Resteren 45996 bytes voor lokale variabelen. Maximum is 81920 bytes.
Uploading 401584 bytes from /var/folders/5l/fjrz26dn5710yvf5hgzlcvsw0000gn/T/arduino_build_570333/StreamMP3FromHTTP.ino.bin to flash at 0x00000000
................................................................................ [ 20% ]
................................................................................ [ 40% ]
................................................................................ [ 61% ]
................................................................................ [ 81% ]
.........................................................................        [ 100% ]

@gerardwr
Copy link
Author

Now running StreamMP3fromHTTP sketch from the latest GIT:

  • connects OK
  • starts with the earlier reported decoding errors with increasing byte offset values
  • after "a while" the sketch repeatedly reports "MP3 done", that looks promising.
  • cannot find a working earpiece right now :-( so hopefully I get sound from the ESP8266 later :-)

Is this the behaviour you expect from the sketch?

...Connecting to WiFi
...Connecting to WiFi
...Connecting to WiFi
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 0
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 418
Decoding error 0x0101 (lost synchronization) at byte offset 2054
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 2090
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 2508
Decoding error 0x0101 (lost synchronization) at byte offset 15453
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 15464
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 15882
Decoding error 0x0101 (lost synchronization) at byte offset 30462
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 30511
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 30929
Decoding error 0x0101 (lost synchronization) at byte offset 43862
.
<many more similar lines with increasing byte offset value
.
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 844695
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 845113
Decoding error 0x0101 (lost synchronization) at byte offset 858046
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 858070
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 858488
Decoding error 0x0101 (lost synchronization) at byte offset 873054
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 873117
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 873535
Decoding error 0x0101 (lost synchronization) at byte offset 886453
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 886491
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 886909
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
.
<unending MP3 done lines>
.

@gerardwr
Copy link
Author

Now tested the example in the README.MD playing the stream from http://mp3radio.com/playback" with the extra buffer.

After uploading/resetting the ESP8266 the "MP3 done" starts immediately without the former "Decoding error" lines.

Looks like SUCCESS to me!! Now searching for a working earpiece ;-)

sl�l⸮⸮|�⸮l⸮|�⸮l⸮c|⸮⸮�⸮�⸮{⸮c⸮c⸮⸮oo⸮loo⸮⸮⸮c�p⸮lsl{lp⸮o⸮����⸮�d�⸮⸮���c�o⸮|�d⸮��⸮c⸮⸮oo⸮�d⸮⸮d`�⸮��nn�d`���o{⸮⸮⸮o��c�⸮�l�{⸮⸮o��c�⸮�l⸮⸮⸮⸮⸮⸮⸮⸮⸮`�⸮⸮o⸮�⸮MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
<etcetera>

@earlephilhower
Copy link
Owner

All those warnings you've got on the latest GIT are in the main Arduino code, not the audio portion. They're harmless, but I'm sure igrr wouldn't mind a PR if you want to fix them.

As to the "MP3 done," that actually means the MP3 is..err...done, and not playing any more. So the socket got closed, the file was completed, etc.

The example http address in the readme isn't a real URL. I thought it was obvious, but I guess not. You'll need to replace that with a real MP3 stream URL to run it.

One other possibility is that the errors are related to things like ICY tags or ID3 or other form of station identification.

@gerardwr
Copy link
Author

gerardwr commented Nov 19, 2017

Understand. For testing the sketch in the README I used the URL "http://streaming.shoutcast.com/80sPlanet?lang=en-US" used in the StreamMp3FromHttp example sketch.

Tried this URL in a browser windows and the stream plays, si I assume it's OK for testing the sketch.

But I still get every second the "Mp3 done" message. Now I know this indicates that no sound is played.

Will do some more testing tomorrow.

Thanks for your support so far in tackling my issues!

@gerardwr
Copy link
Author

Started again to do some testing to get this beauty working, sorry to bother you, again.

TEST 1

As "baseline" I uploaded example sketch PlayWavFromProgmem. Works perfectly, violin sounds through speaker system connected to RX :-)

TEST 2

Uploaded HTTP stream example from README, using the valid URL from the StreamMp3FromHTTP example. Result:

  • no connection ESP with router is made
  • every second "Mp3 done" in serial monitor.

The sketch contains this line in Setup:

  WiFi.forceSleepBegin();

I think this disables Wifi alltogether, and that would mean that playing the stream is impossible.
I would say this sketch cannot work "as is", or am I mistaken?

TEST 3

Uploaded StreamMP3FromHTTP example, URL="http://streaming.shoutcast.com/80sPlanet?lang=en-US". Result:
1 - ESP connects OK to router (gets IP)
2 - Serial monitor displays 3 lines "Decoding error"
3 - plays appr. 1 second good quality sound from the stream
4 - appr. 1 second silence
Steps 2,3 and 4 repeated until "Mp3 done".

This is the serial monitor output, some further suggestions, maybe, I'm getting banana's here!

 1384, room 16 
tail 8
chksum ...Connecting to WiFi
...Connecting to WiFi
...Connecting to WiFi
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 0
Decoding error 0x0101 (lost synchronization) at byte offset 2054
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 2090
Decoding error 0x0101 (lost synchronization) at byte offset 15453
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 15464
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 15882
Decoding error 0x0101 (lost synchronization) at byte offset 30462
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 30511
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 30929
Decoding error 0x0101 (lost synchronization) at byte offset 43862
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 43886
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 44303

<many similar lines deleted>

Decoding error 0x0101 (lost synchronization) at byte offset 802837
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 802899
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 803317
Decoding error 0x0101 (lost synchronization) at byte offset 816238
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 816274
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 816692
Decoding error 0x0101 (lost synchronization) at byte offset 829638
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 829649
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 830067
Decoding error 0x0101 (lost synchronization) at byte offset 844645
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 844695
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 845113
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done
MP3 done

@earlephilhower
Copy link
Owner

Yup, the README.md example was just intended to show how to add the buffer. That's what I get for cutting-and-pasting code in a text file and expecting it to work

I'll delete it, you should start w/the Stream example and add the buffer instead.

Try a different webserver, or your own sitting on your own network to start. I just picked the first working URL I could find for the example as I don't do any web streaming myself. Looks like you're having bad packet loss between your ESP and that streamcast server...

@gerardwr
Copy link
Author

gerardwr commented Nov 19, 2017

Glad to help, grin!

As said before the stream example (without buffer) "works" alternating good sound with silences. Just tried adding a buffer but that seemed to make things even worse.

Also tried another URL (in my home country), but to no avail.

Spent (to) many hours today, so I'll call it quits for now. Tomorrow is another day :-)

Would be really pleased to get this working. I would love to have a couple of streaming ESP's.

Thx.

@earlephilhower
Copy link
Owner

So it turns out that @armSeb, who's been doing lots of work with me recently, found a bug overnight in the buffer routine which would cause certain reads to return invalid data. You should do a pull of the updated repo and see if it changes things for you.

@gerardwr
Copy link
Author

gerardwr commented Nov 20, 2017

Yep, it changes things dramatically!

First pulled the updated repo and uploaded the example sketch StreamMP3FromHTTP (no buffer). Behaviour was similar as before with repeating "Decoding error" messages and eventually 1-sec repeating "Mp3 done" messages.

Then added a buffer to the sketch. Sound plays with a disturbing hickup of 50Herz or so, but it plays continually, NO "Decoding error" and NO "MP3 done" messages anymore.

Not sure where the 50?Herz hickup is coming from, but it is quite disturbing. But it is dramatic progress for me, it shows that my environment is more or less OK.

Will do some more testing later.

Good show!

@armSeb
Copy link
Contributor

armSeb commented Nov 20, 2017

Hello,

What is the MP3 bitrate ?

@gerardwr
Copy link
Author

For testing I used this URL, but I have no clue what the bitrate is, sorry:
http://icecast.omroep.nl/radio1-bb-mp3

@gerardwr
Copy link
Author

For fun I just tried the default URL in the sketch:
http://streaming.shoutcast.com/80sPlanet?lang=en-US

Wow, NO 50?Hz hickups with this stream, perfect sound !!!!!! Just a "crackle" now and then.

Also no idea what the bitrate for this stream is :-(

@armSeb
Copy link
Contributor

armSeb commented Nov 20, 2017

It's 192kbit/s 48000 Hz.

Please try with 44100Hz streaming ;)

And for buffer, you can try 4096 or 8192 bytes.

@earlephilhower
Copy link
Owner

Great feedback on the example. I've just added buffering to the sample code so it's obvious to new users how to do it.

@gerardwr
Copy link
Author

@earlephilhower : Glad that I could give something back to you guys!

@gerardwr
Copy link
Author

@armSeb : Now that I know that bitrate is an issue I investigated the bitrate of the tested streams (opened stream in iTunes and showed INFO).

These are the streams and results I tested so far (note : loooong lines, scrolling required):

// const char *URL="http://streaming.shoutcast.com/80sPlanet?lang=en-US"; // 80sPlanet radio, 128kbps 44.1 kHz : works, only occasional a hickup
// const char *URL="http://icecast.omroep.nl/radio1-bb-mp3";              // Dutch Radio 1, 128kbps 48.0 kHz : works with a 50Hz hickup hickups (mayne hight mp3 bitrate)
// const char *URL="http://91.221.151.155:80/;?.mp3";                     // Arrow Classick Rock, 128kbps 44.1 kHz : works, only occasional a hickup

The 44.1kHz@128kbps work satisfactory, the 48kHz@128kbps stream has severe hickups.

Increasing the buffer to 4096 : I THINK the number of small hickups decreased, but it may be wishfull thinking.
Increasing the buffer to 8192 : This resulted in many hickups and standstills. May be a coincidence, no scientific testing done :-)

Will do some more testing when I'm alone in the house, so not to bother them with the crackles and hickups :-)

@earlephilhower
Copy link
Owner

I think the issue is that at 48KHz the audio output portion that copies to I2S isn't being called often enough due to WiFi and other background ops taking time.

The ESP8266 can decode samples at >> 48KHz with no problem, probably even @ 80MHz, but there's a minuscule I2S buffer of only 11ms @ 44KHz, which is <10ms @48khz. Even if you've got 20ms of data decoded and ready to go, only what fits in the I2S buffer will be used if there's a delay somewhere in the whole system.

I've put in a PR to let a user app override this default, esp8266/Arduino#3790 , but it's obviously a low priority for them as they're releasing a new version soon and cleaning up existing features. The change is easy and you could hand-apply it if you're running the GIT head simply enough and set a larger buffer count.

Are you using an I2S DAC or the SW one? If it's the SW one you are using more CPU (~10 more insns/sample) than the HW DAC, so that makes it even harder to hit 48KHz...

One simple, if unappealing, way to work around this is to introduce a subsampler. It's not rocket science to downsample from 48KHz->44.1KHz if you don't care too much about noise floors, and then you gain an extra 1ms or 2 of time to play around in background tasks.

@gerardwr
Copy link
Author

@earlephilhower : Thanks for enlightening me re. the 48kHz issue. The fact is that I just happened to test using a stream that was MP3 @ 48kHz. The stream I'm mostly interested is an AAC stream @128KBPS.

From your explanation I gues the small I2S is the major bottleneck. I read the PR and I think I can manage changing it to a larger buffer count. Before I'll go that route I'll refrain myself to getting "the best quality sound" using the current default.

I'm currently using the SW DAC, one challenge at a time, right ;-)
I understand this "wastes" some extra CPU power compared to an I2S DAC.

So for now, I'll focus on getting the AAC @128KBPS as good as possible. Then I'll know what imperfection I will have to deal with.

Many thanks for the inspiration.

@gerardwr
Copy link
Author

@armSeb : did some more tests with different buffer sizes:
2048 works
4096 works (a bit better, less hickups)
8192 does not work at all (MP3 done) or dramatic hickups
Possibly setting the buffer to 8192 consumer all RAM?

@armSeb
Copy link
Contributor

armSeb commented Nov 20, 2017

8192 works for me, but I think the best compromise is 4096. You need free heap to be able to decode mp3 (and AAC) correctly.

I received my SPI RAM chip, I need some time to plug it an begin the tests. If I can use it, this will bring 128kbytes of buffer, without eating the main RAM.

@gerardwr
Copy link
Author

@armSeb : Not sure why 8192 fails for me, but for now I'll stick with 4096.

Adding extra RAM will certainly help. Too bad that it adds an extra component, the fact that it runs on "just" a basic ESP8266 with a speaker is magic.

@armSeb
Copy link
Contributor

armSeb commented Nov 20, 2017

Yeah but with a real DAC you really get a nice stereo sound :)

@gerardwr
Copy link
Author

Stereo, hickups from 2 sides ;-)

Seriously, a DAC is certainly worth the couple of $$.

@armSeb
Copy link
Contributor

armSeb commented Nov 20, 2017

Really ?

I bought this one : https://www.ebay.com/itm/PCM5102A-DAC-Decoder-I2S-32bit-Player-Module-Beyond-ES9023-PCM1794-Raspberry-Pi/331976578784

Without DAC you already have to decode stereo mp3, then converted to mono.

@gerardwr
Copy link
Author

gerardwr commented Nov 20, 2017

I believe a saw an even cheaper one on Aliexpress, but can't find it right now. If I do find it again , I'll let you know.

So the SW DAC wastes CPU cycles?, had no idea.

I am more of a SW guy myself, but I guess there's no way avoiding a hardware DAC :-(

Signing off for tonite.

@armSeb
Copy link
Contributor

armSeb commented Nov 22, 2017

lwip2 seems less optimized than lwip1. But using lwip1 from the latest esp8266 git repo seems to be better than the stable version (more stable, more performant).

@gerardwr
Copy link
Author

gerardwr commented Nov 22, 2017

lwip variants you can choose in the Arduino IDE are:

V2 - this is the default
Prebuilt source (gcc)
Espressif (xcc)
Open Source (gcc)

The V2 default resulted in a lot of connection trouble i.c.w. ESP8266AUDIO, setting the lwip variant to Prebuilt source (gcc) solved these problems. Did not try the other variants to choose from, yet.

The lwip variants for the IDE are defined in BOARDS.TXT, but did no further investigation

https://github.com/esp8266/Arduino/blob/7315095e464397ae3f4dc9f1d231278e61242b04/boards.txt

generic.menu.LwIPVariant.open.build.lwip_include=lwip2/include
generic.menu.LwIPVariant.open.build.lwip_lib=-llwip2
generic.menu.LwIPVariant.Prebuilt=Prebuilt Source (gcc)
generic.menu.LwIPVariant.Prebuilt.build.lwip_lib=-llwip_gcc
generic.menu.LwIPVariant.Prebuilt.build.lwip_flags=-DLWIP_OPEN_SRC
generic.menu.LwIPVariant.Espressif=Espressif (xcc)
generic.menu.LwIPVariant.Espressif.build.lwip_lib=-llwip
generic.menu.LwIPVariant.Espressif.build.lwip_flags=-DLWIP_MAYBE_XCC
generic.menu.LwIPVariant.OpenSource=Open Source (gcc)
generic.menu.LwIPVariant.OpenSource.build.lwip_lib=-llwip_src
generic.menu.LwIPVariant.OpenSource.build.lwip_flags=-DLWIP_OPEN_SRC

@armSeb
Copy link
Contributor

armSeb commented Nov 22, 2017

I choose the Open Source variant ;)

@gerardwr
Copy link
Author

Agreed, will do that to, hopefully without any regrets.

@d-a-v
Copy link
Contributor

d-a-v commented Nov 22, 2017

Guys, I am the author of lwip2, and also very interested in this project. @earlephilhower does cool stuff :)
I don't have the hardware yet, but I am now even more interested since lwip2 should be working better than lwip1.4 (it has so far always worked better and solved number tcp issues lwip1 had).
Is StreamMP3FromHTTP the example to compile, with master version of this library or does the problem appears with a specific release ?

I read above that you have buffers problem. There's something you can try with lwip2, it is to change MSS size. It is by default 1460 in lwip1, and I changed it to 536 (the minimum legal in RFCs) so to release memory for the esp8266.
Since you have lwip2, you are using esp8266/Arduino's master. If you are under linux/macos, you can

esp8266$ cd tools/sdk/lwip2
lwip2$ make install  (this will download lwip2 sources)
lwip2$ cd builder/glue-lwip/arduino

edit lwipopts.h and find TCP_MSS, change 536 to 1460

arduino$ cd ../../../
lwip2$ make install

then recompile your sketch selecting lwip-v2 and please report back. I predict performances are at least the same as with lwip-v1.4.

@gerardwr
Copy link
Author

gerardwr commented Nov 22, 2017

Unexpected Compile error using setting lwip variant to "Open Source (gcc)", and the compilation stops.

It complains (in Dutch) about multiple SD libraries, huh? Is probably rigth, but I see no relation to "lwip".

When reverting to lwip variant "Prebuilt Source" the error is gone! So using that for now ;-)

Arduino: 1.8.4 (Mac OS X), Board:"WeMos D1 R2 & mini, 160 MHz, 4M (3M SPIFFS), Open Source (gcc), Disabled, None, 230400"

Build-opties gewijzigd, alles wordt opnieuw gebuild
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [build/api/api_lib.o] Error 2
Meerdere bibliotheken gevonden voor "SD.h"
Gebruikt: /Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/libraries/SD
Niet gebruikt: /Applications/Arduino1.8.4.app/Contents/Java/libraries/SD
exit status 2
Fout bij het compileren voor board WeMos D1 R2 & mini

@gerardwr
Copy link
Author

@d-a-v

Hi,

Thanks for joining this wonderfull topic ;-)

I'm the guy with the major errors using "lwip variant V2". Errors were gone when I switched to "Prebuilt source (gcc)".

Gave updating lwip2 using your recipe a try but it runs into an error.

Tell me if I made a stupid mistake, and I'll try again.

BTW : I'm on a Mac.

imac-van-gerard:lwip2 gerard$ pwd
/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk/lwip2
imac-van-gerard:lwip2 gerard$ make install
git submodule update --init --recursive builder
Submodule 'lwip2' (https://github.com/d-a-v/esp82xx-nonos-linklayer.git) registered for path 'tools/sdk/lwip2/tools/sdk/lwip2/builder'
Cloning into '/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk/lwip2/builder'...
Submodule path 'builder': checked out '9b6966aea4c66ff5d1c6c077dee2641f848c4fdb'
Submodule 'lwip2-src' (https://git.savannah.nongnu.org/git/lwip.git) registered for path 'builder/lwip2-src'
Cloning into '/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk/lwip2/builder/lwip2-src'...
Submodule path 'builder/lwip2-src': checked out '92f23d6ca0971a32f2085b9480e738d34174417b'
make -C builder -f Makefile.arduino install
make -f makefiles/Makefile.build-lwip2 \
			target=arduino \
			SDK=/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk \
			LWIP_ESP=/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk/lwip/include \
			LWIP_LIB=liblwip2.a \
			LWIP_LIB_RELEASE=../../lib/liblwip2.a \
			LWIP_INCLUDES_RELEASE=../include \
			TOOLS=/Users/gerard/Documents/My Data/ArduinoESP/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf- \
			install
make[2]: *** No rule to make target `Data/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk'.  Stop.
make[1]: *** [install] Error 2
make: *** [install] Error 2
imac-van-gerard:lwip2 gerard$ 

@d-a-v
Copy link
Contributor

d-a-v commented Nov 22, 2017

It's the My<SPACE>Data :)
I'll try to fix scripts to handle spaces in paths. In the meantime I can propose you to

  • send you a compiled liblwip2.a with MSS=1460
  • or move your ArduinoESP directory into another path without spaces in it

@gerardwr
Copy link
Author

@d-a-v
Haha, the space in "My Data" has already caused many joys in the past ;-)

Removed the space temporarily, and tried again.

  • make install seems to run OK now
  • "cd builder/glue-lwip/arduino" runs into an error, dir not found.

Here's the output:

imac-van-gerard:lwip2 gerard$ pwd
/Users/gerard/Documents/MyData/ArduinoESP/hardware/esp8266com/esp8266/tools/sdk/lwip2
imac-van-gerard:lwip2 gerard$ make install
make -C builder -f Makefile.arduino install
<snip>
---- moving sntp_get_current_timestamp in IRAM
---- moving millis in IRAM
rm -rf ../include
mkdir -p ../include
cp -a lwip2-src/src/include/* ../include
cp -a glue/gluedebug.h glue-lwip/lwip-git-hash.h glue-lwip/lwip-err-t.h glue-lwip/arch ../include
echo "// this file will be overwritten upon lwip2 rebuild" > ../include/lwipopts.h
echo "#ifndef __CUSTOM_EXTRA_DEFINES__" >> ../include/lwipopts.h
echo "#define __CUSTOM_EXTRA_DEFINES__" >> ../include/lwipopts.h
echo "" >> ../include/lwipopts.h
echo "#endif" >> ../include/lwipopts.h
cat glue-lwip/lwipopts.h >> ../include/lwipopts.h
echo "warning: this directory is re/over/written from lwip2 builder upon lwip2 rebuild" > ../include/README.md
touch ../include/espconn.h
imac-van-gerard:lwip2 gerard$ cd builder/glue-lwip/arduino
-bash: cd: builder/glue-lwip/arduino: No such file or directory
imac-van-gerard:lwip2 gerard$ cd builder/glue-lwip
imac-van-gerard:glue-lwip gerard$ ls
arch			esp-millis.c		esp-sntp.c		lwip			lwip-git-hash.h		lwip-helper.h
esp-dhcpserver.c	esp-millis.h		esp-time.c		lwip-err-t.h		lwip-git.c		lwipopts.h
imac-van-gerard:glue-lwip gerard$ 

@d-a-v
Copy link
Contributor

d-a-v commented Nov 22, 2017 via email

@armSeb
Copy link
Contributor

armSeb commented Nov 22, 2017

Maybe you can remove all the esp8266 dir and make a clean install from git repo.

@d-a-v Thanks for the suggestion, I am now compiling with the MSS modification, I keep you updated :)

@armSeb
Copy link
Contributor

armSeb commented Nov 22, 2017

I am now disconnected immediatly from the server:

Connecting to WiFi
*WM: 
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Already connected. Bailing out.
*WM: IP Address:
*WM: 192.168.1.215
ICY metaint = 16384
Stream size: -1
18056
Buffering...
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 0
MP3 done

With MSS to 1200 it seems to work, but after a while I am disconnected too.

@armSeb
Copy link
Contributor

armSeb commented Nov 22, 2017

With some debugs (with MSS defined to 1460):

Connecting to WiFi
*WM: 
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Already connected. Bailing out.
*WM: IP Address:
*WM: 192.168.1.215
[HTTP-Client][begin] url: http://213.251.190.165/pulsHD.mp3
[HTTP-Client][begin] host: 213.251.190.165 port: 80 url: /pulsHD.mp3
[HTTP-Client] connected to 213.251.190.165:80
[HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.0 200 OK'
[HTTP-Client][handleHeaderResponse] RX: 'icy-notice1:<BR>This stream requires <a href="http://www.winamp.com">Winamp</a><BR>'
[HTTP-Client][handleHeaderResponse] RX: 'icy-notice2:SHOUTcast DNAS/posix(linux x64) v2.5.5.732<BR>'
[HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges:none'
[HTTP-Client][handleHeaderResponse] RX: 'Access-Control-Allow-Origin:*'
[HTTP-Client][handleHeaderResponse] RX: 'Cache-Control:no-cache,no-store,must-revalidate,max-age=0'
[HTTP-Client][handleHeaderResponse] RX: 'Connection:close'
[HTTP-Client][handleHeaderResponse] RX: 'icy-name:PulsRadio DANCE'
[HTTP-Client][handleHeaderResponse] RX: 'icy-genre:Dance, Trance, Electronic, Lounge, Techno'
[HTTP-Client][handleHeaderResponse] RX: 'icy-br:192'
[HTTP-Client][handleHeaderResponse] RX: 'icy-sr:44100'
[HTTP-Client][handleHeaderResponse] RX: 'icy-url:https://www.pulsradio.com/dance'
[HTTP-Client][handleHeaderResponse] RX: 'icy-pub:1'
[HTTP-Client][handleHeaderResponse] RX: 'content-type:audio/mpeg'
[HTTP-Client][handleHeaderResponse] RX: 'icy-metaint:16384'
[HTTP-Client][handleHeaderResponse] RX: 'X-Clacks-Overhead:GNU Terry Pratchett'
[HTTP-Client][handleHeaderResponse] RX: ''
[HTTP-Client][handleHeaderResponse] code: 200
ICY metaint = 16384
Stream size: -1
15192
Buffering...
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 0
[HTTP-Client][end] still data in buffer (658), clean up.
[HTTP-Client][end] tcp stop
MP3 done
MP3 done
MP3 done

@earlephilhower
Copy link
Owner

+1 for the Pratchett header in the server response!

Anyway, I've been tweaking the ICY and HTTP readers. They can now automatically reconnect on 0-byte reads a user-specified number of times. Last night I had about 2.5hrs streaming before it couldn't reconnect (and at that point there was a internet or server issue because it tried 3 times over the span of 3 seconds to reconnect before giving up). @armSeb and @gerardwr , I'd suggest pulling the changes and adding a "file->SetReconnect(3, 500)" before you start a stream to enable it.

To avoid the issue of LWIP settings, you may want to try using the GIT I've got (by sheer luck) for the Arduino core. I couldn't tell you what LWIP it's running, only that it works and my only change has been addition of the HTTPS server pull request (3001 in the Arduino repo).

commit 5c01841430d5f93d5334c56f3b708995912a8675
Author: Ivan Grokhotkov <ivan@espressif.com>
Date:   Tue Oct 31 02:05:40 2017 +0800

    sdk: update to v2.1.0-14-g33f234f
    
    https://github.com/espressif/ESP8266_NONOS_SDK/commit/33f234f4a6defafec2f9442dcc0bb1ebdb80c42f

@d-a-v Forgive my TCP ignorance, but for some reason my Master's networking all involved ATM and its ilk, not TCP. If MSS = 600 and I do a http.read (1000) will I get a short read each time, or will it recombine multiple segments before sending it back to me? The algorithm can try combining multiple reads on short reads, but doesn't now, as before the max segment was >> than any MP3 or ADTS frame.

@armSeb
Copy link
Contributor

armSeb commented Nov 22, 2017

I think the MSS=536 is a bad setting, as it forces the router to fragment packets and causes several latencies.

I guess that the socket buffer re-assemble all chunks.

Keeping MSS to 1460 seems (in my opinion) to be the best choice.

@gerardwr
Copy link
Author

@d-a-v
Updated to latest ESP8266/Arduino Master, changed MSS from 536 to 1460 acc. your recipy, and compiled StreamMP3FromHTTP sketch using lwip v2.

Playing MP3 stream with MSS=536 was not working for me with "decoding errors" every sec, better with MSS=1460, but most of the time the streaming stops ("Mp3 done") within several seconds.

When using variant "Prebuild source (gcc)" an Mp3 stream plays for "hours" without interruption.

@gerardwr
Copy link
Author

gerardwr commented Nov 22, 2017

@earlephilhower

  • Updated to todays repo with "tweaking the ICY and HTTP readers".
  • Previous version played MP3 stream often for several hours, without disruption. Latest version plays fine too
  • Then added SetReconnect
  file->SetReconnect(3, 500);
  mp3->begin(buff, out);
  • Plays fine too, but because of the already reliable playing of the previous version I have not perceived a change.
    UPDATE 1 : Running for 1 hour without any "Buffering" or "Decoding error"

Final question : Sometimes the former version stopped streaming with "MP3 done" after some hours. Should I expect the latest version to play "forever"?

@gerardwr
Copy link
Author

@earlephilhower
Started streaming AAC stream overnight (latest repo + Setreconnect) and the stream was still running OK this morning (> 10 hours). Could not check for messages in the serial monitor, Mac was off :-)

Excellent!

@earlephilhower
Copy link
Owner

Great news. If there are no network hiccups greater than (retries * delay) it should play indefinitely. For me, I think I'm on the wrong side of the Atlantic for the streamer I was using and did have real disconnects lasting > 1.5 seconds every few hours, but there's nothing to be done for that, really.

@gerardwr
Copy link
Author

I'm really happy with the library playing my favorite Mp3 stream all day, too bad that the AAC stream has artefacts :-( (ref. issue #12).

Many thanks for sharing the library and the provided support.

@armSeb
Copy link
Contributor

armSeb commented Nov 24, 2017

Hello,

With the improved code I am now able to play the 48000Hz stream: http://icecast.omroep.nl/radio1-bb-mp3

@gerardwr
Copy link
Author

I replied earlier that the latest repo performed worse, but I deleted this reply because accidentily tested with a 80Mhz CPU i.o. 160Mhz.

Installed the latest repo, and tested the 48kHz MP3 stream : Stream runs but has quite some disturbances like "speckles".

Maybe due to a temporary stream issue, as I got "reconnects after a while. Will try again later.

...Connecting to WiFi
...Connecting to WiFi
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 0
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 140
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 935908
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 936140
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 941748
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 941900
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 951756
Decoding error 0x0102 (reserved header layer value) at byte offset 951796
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 955708
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 961548
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 965928
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 971340
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 975947
No stream data available
Stream disconnected

Attempting to reconnect, try 0
Attempting to reconnect, try 1
Attempting to reconnect, try 2
Unable to reconnect
Stream disconnected

Attempting to reconnect, try 0
Attempting to reconnect, try 1
Attempting to reconnect, try 2
Unable to reconnect
Stream disconnected

Attempting to reconnect, try 0
Attempting to reconnect, try 1
Attempting to reconnect, try 2
Unable to reconnect
Stream disconnected

Attempting to reconnect, try 0

@gerardwr
Copy link
Author

I ran the 48K stream overnight, was still running this morning :-) so seems "bulletproof".

But the sream is still spoiled by the continuous "speckles", as if as motorcycle with a bad ignition coil is running nearby.

Restarted the ESP, but the speckles remain. Sometimes the ESP resets, but the stream is resumed automagically.

Decoding error 0x0101 (lost synchronization) at byte offset 7810340
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 7810476
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 7836939
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 7836972
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 7855138

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
vffffffff
~ld
Connecting to WiFi
...Connecting to WiFi
...Connecting to WiFi
...Connecting to WiFi
...Connecting to WiFi
...Connecting to WiFi
Buffering...
Decoding error 0x0101 (lost synchronization) at byte offset 0
Decoding error 0x0104 (reserved sample frequency value) at byte offset 51
Decoding error 0x0103 (forbidden bitrate value) at byte offset 552
Decoding error 0x0235 (bad main_data_begin pointer) at byte offset 553

@gerardwr
Copy link
Author

Just to make sure, with the latest the 48K Radio1 stream has "speckles" BUT the Morow 44K MP3 stream is absolutely clean. Nice!

@earlephilhower
Copy link
Owner

Any reason to keep this open? I think we're tracking all the other things in other active issues.

@gerardwr
Copy link
Author

Agreed, have closed this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants