[SOLVED] OGG playback problem

Dec 13, 2014 at 11:08 PM
Edited Dec 13, 2014 at 11:18 PM
Today I faced some problem with your NVorbis lib. I tried to play some OGG file and got following error msg...

System.IO.InvalidDataException: Found invalid data to decode.
at NVorbis.Ogg.PacketReader.AddPacket(Packet packet)
at NVorbis.Ogg.ContainerReader.AddPage(PageHeader hdr)
at NVorbis.Ogg.ContainerReader.GatherNextPage()
at NVorbis.Ogg.ContainerReader.GatherNextPage(Int32 streamSerial)
at NVorbis.Ogg.PacketReader.PeekNextPacketInternal()
at NVorbis.Ogg.PacketReader.GetNextPacket()
at NVorbis.VorbisStreamDecoder.TryInit()
at NVorbis.VorbisReader.NewStream(Object sender, NewStreamEventArgs ea)
at NVorbis.Ogg.ContainerReader.GatherNextPage()
at NVorbis.Ogg.ContainerReader.Init()
at NVorbis.VorbisReader.LoadContainer(IContainerReader containerReader)
at NVorbis.VorbisReader..ctor(Stream stream, Boolean closeStreamOnDispose)
at NVorbis.VorbisReader..ctor(String fileName)
at NVorbis.NAudioSupport.VorbisFileReader..ctor(String fileName)
at MultiWave.FormMain.PlaySoundInDevice(Int32 deviceNumber, String fileName)
at MultiWave.FormMain.PlayInAllSelectedDevices(String fileName)
at MultiWave.FormMain.BtnPlay_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at MultiWave.FormMain.BtnBrowse_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Working audio:

ID : 28286 (0x6E7E)
Format : Vorbis
Format settings for Floor : 1
Lenght : 3min 41s
Bitrate mode : variable
Bitrate : 500 Kbps
Channels : 2 Channels
Sampling rate : 44,1 KHz
Stream size : 13,2 MiB
Used Encoding lib : libVorbis (Omnipresent) (20120203 (Omnipresent))

Not working audio:

ID : 28763 (0x705B)
Format : Vorbis
Format settings for Floor : 1
Lenght : 3min 47s
Bitrate mode : variable
Bitrate : 500 Kbps
Channels : 2 Channels
Sampling rate : 44,1 KHz
Stream size : 13,6 MiB
Used Encoding lib : libVorbis (Omnipresent) (20120203 (Omnipresent))

Example audio files (working and not working audio files):

Thanks for helping (and fixing the problem)! :)

Best regards
Marked as answer by NoRush on 12/15/2014 at 10:33 AM
Dec 14, 2014 at 2:02 PM
I haven't actually looked at the files yet, but that error should only happen when the reader got a "continuation" packet but wasn't expecting it (basically, the page header on a page indicated the first packet is split with the previous page, but the previous page didn't end on a partial packet). This may be due to a mis-read or an de-sync, but I'll have to check the data first... Later today, maybe.
Dec 14, 2014 at 3:42 PM
Thanks for the reply. I will wait then. ;)
Dec 15, 2014 at 2:39 AM
Wow, the "non-working" file has a 110,842 byte comment packet... The page reader didn't know how to handle that properly, so it just "assumed" the packet was complete and blew up when the next packet said it had a "continuation". I've updated the source to handle this situation correctly, so you should be good (just build the library from source).

Thanks for the bug report!
Dec 15, 2014 at 2:22 PM
Edited Dec 15, 2014 at 5:33 PM
Thank you so much! :)
Will test it this evening.

It's working now, thanks so much! :)

Best regards