karlheyes / icecast-kh

KH branch of icecast
GNU General Public License v2.0
300 stars 107 forks source link

kh-20: EROR format-ogg/process_initial_page Seen BOS page with unknown type #405

Closed DroidU closed 1 year ago

DroidU commented 1 year ago

If I use MPD (https://www.musicpd.org/) as the source client and OggFLAC is the encoder, it fails. With the same MPD it works fine for Icecast 2.4.4.

Log: [2023-03-18 16:20:37] EROR format-ogg/process_initial_page Seen BOS page with unknown type [2023-03-18 16:20:37] EROR format-ogg/ogg_get_buffer Problem processing stream

icecast2.xml: https://pastebin.com/b8rHX8b8 mpd.conf for testing: https://pastebin.com/wjyUGP3v

karlheyes commented 1 year ago

this should be resolved in kh20.4 now.

DroidU commented 1 year ago

It's almost perfect. Most players play it fine, however Liquidsoap reconnects to the server when MPD jump to the next song. Liquidsoap also works well with official Icecast 2.4.4. With the "ffprobe -loglevel trace" command, I checked the difference between the two Icecast2 streams. In the case of kh, I noticed the thing highlighted in bold. This is probably why Liquidsoap reconnects.

[ogg @ 0x55b77f541680] Format ogg probed with size=2048 and score=100 [ogg @ 0x55b77f541680] ogg_packet: curidx=-1 [ogg @ 0x55b77f541680] ogg_packet: idx=0 pstart=0 psize=0 segp=0 nsegs=1 [ogg @ 0x55b77f541680] ogg_packet: curidx=-1 [ogg @ 0x55b77f541680] ogg_packet: idx=0 pstart=51 psize=0 segp=0 nsegs=159 [ogg @ 0x55b77f541680] found headers [ogg @ 0x55b77f541680] Headers mismatch for stream 0: expected 2 received 1. [ogg @ 0x55b77f541680] Before avformat_find_stream_info() pos: 40420 bytes read:41487 seeks:0 nb_streams:1 [ogg @ 0x55b77f541680] ogg_packet: curidx=0 [ogg @ 0x55b77f541680] ogg_packet: idx=0 pstart=51 psize=0 segp=0 nsegs=159 [ogg @ 0x55b77f541680] All info found [ogg @ 0x55b77f541680] stream 0: start_time: 0 duration: NOPTS [ogg @ 0x55b77f541680] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=0 kb/s [ogg @ 0x55b77f541680] After avformat_find_stream_info() pos: 40420 bytes read:41487 seeks:0 frames:1

karlheyes commented 1 year ago

looks like mpd was sending something odd but valid so I have reworked the code to ignore the reported header count and processed headers as they are pulled out. There was also a use case of packets being larger than pages which may never happen in real life but is in the spec which should be handled, that is still an possible issue in xiph codebase

code in the master tree

DroidU commented 1 year ago

Now it works perfectly with Liquidsoap. I also noticed that the "Current Song" section on the status.xsl page is blank for OggFLAC streams. The players display the song title, and Liquidsoap which is used as a Stream Transcoder displays it on the mountpoint where it encodes.

karlheyes commented 1 year ago

I have done a kh20.5 pre-release with those changes I mentioned. The metadata is something that needs implementing. I doubt that will be done before kh21 though. In a code settling down phase. The headers are identified properly now, it just requires selecting the correct one and pulling metadata for the stats. I was also wondering about flac detection outside of ogg