33 *
44 * Created on: Oct 28.2018
55 *
6- * Version 3.0.13zb
7- * Updated on: Dec 26 .2024
6+ * Version 3.0.13zc
7+ * Updated on: Dec 29 .2024
88 * Author: Wolle (schreibfaul1)
99 *
1010 */
@@ -2979,6 +2979,14 @@ const char* Audio::m3u8redirection(uint8_t* codec) {
29792979 }
29802980
29812981 char * tmp = nullptr ;
2982+ choosenLine++; // next line is the redirection url
2983+
2984+ if (cS == 100 ) { // "mp4a.xx.xx" not found
2985+ *codec = CODEC_AAC; // assume AAC
2986+ for (uint16_t i = 0 ; i < plcSize; i++) { // we have no codeString, looking for "http"
2987+ if (startsWith (m_playlistContent[i], " http" )) choosenLine = i;
2988+ }
2989+ }
29822990
29832991 // if((!endsWith(m_playlistContent[choosenLine], "m3u8") && indexOf(m_playlistContent[choosenLine], "m3u8?") == -1)) {
29842992 // // we have a new m3u8 playlist, skip to next line
@@ -2990,7 +2998,7 @@ const char* Audio::m3u8redirection(uint8_t* codec) {
29902998 // goto exit;
29912999 // }
29923000 // }
2993- choosenLine++; // next line is the redirection url
3001+
29943002
29953003 if (!startsWith (m_playlistContent[choosenLine], " http" )) {
29963004
@@ -3447,7 +3455,10 @@ void Audio::processWebStreamTS() {
34473455 return ;
34483456 }
34493457 }
3450- ts_parsePacket (&ts_packet[0 ], &ts_packetStart, &ts_packetLength);
3458+
3459+ if (!ts_parsePacket (&ts_packet[0 ], &ts_packetStart, &ts_packetLength)){
3460+ f_chunkFinished = true ; // something went wrong
3461+ }
34513462
34523463 if (ts_packetLength) {
34533464 size_t ws = InBuff.writeSpace ();
@@ -3466,7 +3477,8 @@ void Audio::processWebStreamTS() {
34663477 f_chunkFinished = true ;
34673478 byteCounter = 0 ;
34683479 }
3469- if (byteCounter > m_contentlength) log_e (" byteCounter overflow" );
3480+ if (m_contentlength && byteCounter > m_contentlength) {log_e (" byteCounter overflow, byteCounter: %d, contentlength: %d" , byteCounter, m_contentlength); return ;}
3481+ if (chunkSize && byteCounter > chunkSize) {log_e (" byteCounter overflow, byteCounter: %d, chunkSize: %d" , byteCounter, chunkSize); return ;}
34703482 }
34713483 }
34723484 if (f_chunkFinished) {
@@ -5453,6 +5465,7 @@ void Audio::IIR_filterChain2(int16_t iir_in[2], bool clear) { // Infinite Impuls
54535465// AAC - T R A N S P O R T S T R E A M
54545466// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
54555467bool Audio::ts_parsePacket (uint8_t * packet, uint8_t * packetStart, uint8_t * packetLength) {
5468+
54565469 const uint8_t TS_PACKET_SIZE = 188 ;
54575470 const uint8_t PAYLOAD_SIZE = 184 ;
54585471 const uint8_t PID_ARRAY_LEN = 4 ;
@@ -5497,9 +5510,12 @@ bool Audio::ts_parsePacket(uint8_t* packet, uint8_t* packetStart, uint8_t* packe
54975510 // 11 – adaptation field followed by payload, 00 – RESERVED for future use
54985511 // CC Continuity counter, Sequence number of payload packets (0x00 to 0x0F) within each stream (except PID 8191)
54995512
5513+ // for(int i = 1; i < 188; i++) {printf("%02X ", packet[i - 1]); if(i && (i % 16 == 0)) printf("\n");}
5514+ // printf("\n----------\n");
5515+
55005516 if (packet[0 ] != 0x47 ) {
5501- log_e (" ts SyncByte not found, first bytes are %X %X %X %X " , packet[0 ], packet[1 ], packet[2 ], packet[3 ]);
5502- stopSong ();
5517+ log_e (" ts SyncByte not found, first bytes are 0x%02X 0x%02X 0x%02X 0x%02X " , packet[0 ], packet[1 ], packet[2 ], packet[3 ]);
5518+ // stopSong();
55035519 return false ;
55045520 }
55055521 int PID = (packet[1 ] & 0x1F ) << 8 | (packet[2 ] & 0xFF );
0 commit comments