schreibfaul1 / ESP32-audioI2S

Play mp3 files from SD via I2S
GNU General Public License v3.0
1k stars 266 forks source link

Format .m3u8 not working #601

Open tv4you2016 opened 9 months ago

tv4you2016 commented 9 months ago

hello @schreibfaul1

When I try to reproduce this url the reboot esp

Media URL: https://stream-hls.bauermedia.pt/comercial.aac/playlist.m3u8

Log:

[ 66660][V][ssl_client.cpp:324] stop_ssl_socket(): Cleaning SSL connection. [ 66661][I][Audio.cpp:5861] ts_parsePacket(): parseTS reset [ 66662][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 148232 [ 66669][V][ssl_client.cpp:68] start_ssl_client(): Starting socket [ 66834][V][ssl_client.cpp:149] start_ssl_client(): Seeding the random number generator [ 66836][V][ssl_client.cpp:158] start_ssl_client(): Setting up the SSL/TLS structure... [ 66839][D][ssl_client.cpp:179] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE! [ 66847][V][ssl_client.cpp:257] start_ssl_client(): Setting hostname for TLS session... [ 66856][V][ssl_client.cpp:272] start_ssl_client(): Performing the SSL/TLS handshake... [ 68066][V][ssl_client.cpp:293] start_ssl_client(): Verifying peer X.509 certificate... [ 68066][V][ssl_client.cpp:301] start_ssl_client(): Certificate verified. [ 68069][V][ssl_client.cpp:316] start_ssl_client(): Free internal heap after TLS 105484 [ 68077][V][ssl_client.cpp:369] send_ssl_data(): Writing HTTP request with 154 bytes... [ 68478][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: HTTP/1.1 200 OK [ 68479][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: content-length: 216 [ 68484][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: pragma: no-cache [ 68492][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: expires: Mon, 26 Jul 1997 05:00:00 GMT [ 68502][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: instance-id: 75831741d5e5a758a441bd 93c71b9fcb [ 68513][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: server: edge-bauerpthls-08-thn.shar p-stream.com 9.0.7 [ 68524][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: accept-ranges: bytes [ 68532][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: content-type: application/vnd.apple .mpegurl [ 68543][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: cache-control: no-cache [ 68552][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: set-cookie: ListenerInfo=reset; Pat h=/; Domain=stream-hls.bauermedia.pt; Expires=Tue, 10 Oct 2023 19:09:49 GMT; SameSite=None; Secure [ 68570][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: x-response-server: edge-bauerpthls- 08 [ 68580][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: access-control-allow-origin: [ 68589][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: access-control-allow-credentials: t rue [ 68599][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: set-cookie: SERVERID=edge-bauerpthl s-08; path=/; Secure; SameSite=None [ 68611][I][Audio.cpp:4072] parseHttpResponseHeader(): now parse playlist [ 68641][E][Audio.cpp:2640] readPlayListData(): m3u8 playlists requires PSRAM enabled! [ 68646][I][Audio.cpp:2735] readPlayListData(): pl=0 "#EXTM3U" [ 68650][I][Audio.cpp:2735] readPlayListData(): pl=1 "#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2"" [ 68660][I][Audio.cpp:2735] readPlayListData(): pl=2 "https://stream-hls.bauermedia.pt:443/comercial.aac/playl ist.m3u8?listeningSessionID=650047c5723f9ac7_2451400_0H2GS9rM00000003TZj&downloadSessionID=0" [ 68689][I][Audio.cpp:2943] parsePlaylist_M3U8(): redirect https://stream-hls.bauermedia.pt:443/comercial.aac/ playlist.m3u8?listeningSessionID=650047c5723f9ac7_2451400_0H2GS9rM__00000003TZj&downloadSessionID=0 [ 68705][V][ssl_client.cpp:324] stop_ssl_socket(): Cleaning SSL connection. [ 68707][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 147708 [ 68714][V][ssl_client.cpp:68] start_ssl_client(): Starting socket [ 68767][V][ssl_client.cpp:149] start_ssl_client(): Seeding the random number generator [ 68768][V][ssl_client.cpp:158] start_ssl_client(): Setting up the SSL/TLS structure... [ 68771][D][ssl_client.cpp:179] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE! [ 68780][V][ssl_client.cpp:257] start_ssl_client(): Setting hostname for TLS session... [ 68788][V][ssl_client.cpp:272] start_ssl_client(): Performing the SSL/TLS handshake... [ 70130][V][ssl_client.cpp:293] start_ssl_client(): Verifying peer X.509 certificate... [ 70130][V][ssl_client.cpp:301] start_ssl_client(): Certificate verified. [ 70133][V][ssl_client.cpp:316] start_ssl_client(): Free internal heap after TLS 105328 [ 70141][V][ssl_client.cpp:369] send_ssl_data(): Writing HTTP request with 224 bytes... [ 71049][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: HTTP/1.1 200 OK [ 71050][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: content-length: 3381 [ 71055][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: pragma: no-cache [ 71063][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: expires: Mon, 26 Jul 1997 05:00:00 GMT [ 71073][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: instance-id: ded8f868bfaa7d54552356 5778f5d113 [ 71083][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: server: edge-bauerpthls-09-gos2.sha rp-stream.com 9.0.7 [ 71095][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: accept-ranges: bytes [ 71103][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: content-type: application/vnd.apple .mpegurl [ 71114][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: cache-control: no-cache [ 71123][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: set-cookie: ListenerInfo=ZGVkOGY4Nj hiZmFhN2Q1NDU1MjM1NjU3NzhmNWQxMTM7MDs7MDtnZW5lcmF0ZWRfYmY2M2YwMTBjMTgxNmM3YWViZjAxYjA0NGQ1NDA5ODA7MTY5Njk2ODQ5 ODk4NDswLzEwMDA7ODAwMDA7dCwxNjk2OTY4NDc4OTc0O3QsMTY5Njk2ODQ4ODk3ODt0LDE2OTY5Njg0OTg5ODQ=; Path=/; Domain=strea m-hls.bauermedia.pt; Max-Age=40; Expires=Tue, 10 Oct 2023 20:10:32 GMT; SameSite=None; Secure [ 71160][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: set-cookie: AISSessionId=0_650047c5 723f9ac7_2451400_0H2GS9rM00000003TZj; Path=/; Domain=stream-hls.bauermedia.pt; Max-Age=6000; Expires=Tue, 10 Oct 2023 21:49:52 GMT; SameSite=None; Secure [ 71182][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: x-response-server: edge-bauerpthls- 09 [ 71192][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: access-control-allow-origin: [ 71201][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: access-control-allow-credentials: t rue [ 71212][I][Audio.cpp:3866] parseHttpResponseHeader(): httpResponseHeader: set-cookie: SERVERID=edge-bauerpthl s-09; path=/; Secure; SameSite=None [ 71224][I][Audio.cpp:4072] parseHttpResponseHeader(): now parse playlist [ 71254][E][Audio.cpp:2640] readPlayListData(): m3u8 playlists requires PSRAM enabled! [ 71273][I][Audio.cpp:2735] readPlayListData(): pl=0 "#EXTM3U" [ 71273][I][Audio.cpp:2735] readPlayListData(): pl=1 "#EXT-X-VERSION:3" [ 71274][I][Audio.cpp:2735] readPlayListData(): pl=2 "#EXT-X-TARGETDURATION:11" [ 71281][I][Audio.cpp:2735] readPlayListData(): pl=3 "#EXT-X-MEDIA-SEQUENCE:0" [ 71288][I][Audio.cpp:2735] readPlayListData(): pl=4 "#EXT-X-DISCONTINUITY-SEQUENCE:0" [ 71296][I][Audio.cpp:2735] readPlayListData(): pl=5 "#EXTINF:10.005,<?xml version="1.0" encoding="utf-8"?>

2898300000028983.jpg PurposeAlbumJUSTIN BIEBER</DB_DALET_ARTIS T_NAME>SORRY11661 5Justin BieberRádio Comercial</D B_RADIO_NAME>" [ 71345][I][Audio.cpp:2735] readPlayListData(): pl=6 "https://chunks-bauerpt.sharp-stream.com/comercial.aac/i6 32PW0o1dH-169696847-10005.aac" [ 71357][I][Audio.cpp:2735] readPlayListData(): pl=7 "#EXTINF:10.005,<?xml version="1.0" encoding="utf-8"?>
2898300000028983.jpg PurposeAlbumJUSTIN BIEBER</DB_DALET_ARTIS T_NAME>SORRY11661 5Justin BieberRádio Comercial</D B_RADIO_NAME>" [ 71406][I][Audio.cpp:2735] readPlayListData(): pl=8 "https://chunks-bauerpt.sharp-stream.com/comercial.aac/6k 93aKZ1ln-169696848-10005.aac" [ 71419][I][Audio.cpp:2735] readPlayListData(): pl=9 "#EXTINF:9.984,<?xml version="1.0" encoding="utf-8"?>
2898300000028983.jpgP urposeAlbumJUSTIN BIEBER</DB_DALET_ARTIST _NAME>SORRY116615 Justin BieberRádio Comercial</DB _RADIO_NAME><" [ 71468][I][Audio.cpp:2735] readPlayListData(): pl=10 "https://chunks-bauerpt.sharp-stream.com/comercial.aac/j ULP8usGYK7-169696849-9984.aac"

Stack smashing protect failure!

abort() was called at PC 0x4011f13f on core 1

Backtrace:0x40083d29:0x3ffb24100x4008c075:0x3ffb2430 0x400917c1:0x3ffb2450 0x4011f13f:0x3ffb24d0 0x400f80f3:0x 3ffb24f0 0x400faffd:0x3ffb2750 0x400d963e:0x3ffb2770 0x401b0589:0x3ffb2790 0x401b0649:0x3ffb27b0 0x400e0f60:0x 3ffb27d0 0x400e3236:0x3ffb2800 0x40113259:0x3ffb2820

ELF file SHA256: 0000000000000000

Rebooting... ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1184 load:0x40078000,len:13132 load:0x40080400,len:3036 entry 0x400805e4 [ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz

schreibfaul1 commented 9 months ago

Hi @tv4you2016, this is the first m3u8 playlist I've seen in xml format. The crash comes from the large line length and the buffer limit overrides. Additionally, there is the problem that the chunks are not always played in the correct order. This will take some time.

schreibfaul1 commented 8 months ago

I think I've got a handle on it now. I get the correct order of the chunks via the media sequence number. https://stream-hls.bauermedia.pt/comercial.aac/playlist.m3u8 has been running without any problems for an hour. The changes are not in the master. The branch "Arduino V3.0" (with IDF 5.1) contains the relevant updates. As soon as there is a stable Arduino 3 version, the branch will become the master.

Best regards from Berlin Wolle

tv4you2016 commented 7 months ago

Hello @schreibfaul1 , I used the "Arduino V3.0" branch but I still encounter audio stops and I have these errors:

[218574][I][ESP32-iSND1W.ino:885] audio_showstreamtitle(): streamtitle: ONLY IF YOU WANT [246843][E][Audio.cpp:2805] m3u8_findMediaSeqInURL(): not enough lines with "#EXTINF:" found [246844][E][Audio.cpp:2702] parsePlaylist_M3U8(): err, 0 packets lost from 3954716330, to 4294967295 [247464][E][Audio.cpp:2805] m3u8_findMediaSeqInURL(): not enough lines with "#EXTINF:" found [247465][E][Audio.cpp:2679] parsePlaylist_M3U8(): xMediaSequence not found lasthost https://stream-hls.bauermedia.pt/cidhiphop.aac/playlist.m3u8 [248436][E][Audio.cpp:2702] parsePlaylist_M3U8(): err, 1073544496 packets lost from 0, to 0 [250600][I][ESP32-iSND1W.ino:885] audio_showstreamtitle(): streamtitle: ONLY IF YOU WANT [306436][E][Audio.cpp:2805] m3u8_findMediaSeqInURL(): not enough lines with "#EXTINF:" found [306437][E][Audio.cpp:2702] parsePlaylist_M3U8(): err, 0 packets lost from 3954716318, to 4294967295 [307060][E][Audio.cpp:2805] m3u8_findMediaSeqInURL(): not enough lines with "#EXTINF:" found [307060][E][Audio.cpp:2679] parsePlaylist_M3U8(): xMediaSequence not found lasthost https://stream-hls.bauermedia.pt/cidhiphop.aac/playlist.m3u8 [308142][E][Audio.cpp:2702] parsePlaylist_M3U8(): err, 1073544496 packets lost from 0, to 0 [310303][I][ESP32-iSND1W.ino:885] audio_showstreamtitle(): streamtitle: ONLY IF YOU WANT [324272][E][Audio.cpp:2805] m3u8_findMediaSeqInURL(): not enough lines with "#EXTINF:" found [324274][E][Audio.cpp:2702] parsePlaylist_M3U8(): err, 0 packets lost from 3954716314, to 4294967295 [324874][E][Audio.cpp:2805] m3u8_findMediaSeqInURL(): not enough lines with "#EXTINF:" found [324876][E][Audio.cpp:2679] parsePlaylist_M3U8(): xMediaSequence not found lasthost https://stream-hls.bauermedia.pt/cidhiphop.aac/playlist.m3u8 [326019][E][Audio.cpp:2702] parsePlaylist_M3U8(): err, 1073544496 packets lost from 0, to 0 [328013][I][ESP32-iSND1W.ino:885] audio_showstreamtitle(): streamtitle: ONLY IF YOU WANT

schreibfaul1 commented 7 months ago

This error will certainly not occur again. Whereby the station chunks-bauerpt.sharp-stream.com is difficult to receive for me, ping times are okay, but 25% data loss.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 30 days with no activity.