I think I have bumped into the small file error, or I''m doing something stupid. The files are short audio effects for a game (embedded in our own data format). Sample info: Vorbis packets: 1 (4 kb) Samples: 28672 Samplerate: 22 kHz Channels: 2 This is what I''m doing when I want to get a number of bytes from the stream: The problem is that ov_pcm_tell always returns 0. And so does ov_read (its only one packet so EOF) virtual bool GetData(void *&_pData, int &_nBytes) { int NumTimesNoData = 0; while(_nBytes) { long ret; int StartOffset ov_pcm_tell(&m_pDecoder->VorbisFile); if (StartOffset<0) Error("Decode","Offset error"); // uninterleave samples ret = ov_read(&m_pDecoder->VorbisFile,(char *)_pData,_nBytes,0,2,1,&m_pDecoder->Section); int EndOffset ov_pcm_tell(&m_pDecoder->VorbisFile); if (EndOffset<0) Error("Decode","Offset error"); if (EndOffset == StartOffset) ++NumTimesNoData; else NumTimesNoData = 0; _nBytes -= EndOffset - StartOffset; pData += EndOffset - StartOffset; if (NumTimesNoData > 2) { if (m_pDecoder->m_bLoop) { if (ov_pcm_seek(&m_pDecoder->VorbisFile, 0)) Error("Decode", "Seek error in stream"); } return true; } else if (ret < 0) { return false; } } return true; } --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Forgot to mention that I use rc2 source with vorbisfile.c from cvs -----Original Message----- From: Erik Olofsson [mailto:erik@o3games.com] Sent: den 23 november 2001 07:42 To: vorbis-dev@xiph.org Subject: [vorbis-dev] Small vorbis files with vorbisfile I think I have bumped into the small file error, or I''m doing something stupid. The files are short audio effects for a game (embedded in our own data format). Sample info: Vorbis packets: 1 (4 kb) Samples: 28672 Samplerate: 22 kHz Channels: 2 This is what I''m doing when I want to get a number of bytes from the stream: The problem is that ov_pcm_tell always returns 0. And so does ov_read (its only one packet so EOF) virtual bool GetData(void *&_pData, int &_nBytes) { int NumTimesNoData = 0; while(_nBytes) { long ret; int StartOffset ov_pcm_tell(&m_pDecoder->VorbisFile); if (StartOffset<0) Error("Decode","Offset error"); // uninterleave samples ret = ov_read(&m_pDecoder->VorbisFile,(char *)_pData,_nBytes,0,2,1,&m_pDecoder->Section); int EndOffset ov_pcm_tell(&m_pDecoder->VorbisFile); if (EndOffset<0) Error("Decode","Offset error"); if (EndOffset == StartOffset) ++NumTimesNoData; else NumTimesNoData = 0; _nBytes -= EndOffset - StartOffset; pData += EndOffset - StartOffset; if (NumTimesNoData > 2) { if (m_pDecoder->m_bLoop) { if (ov_pcm_seek(&m_pDecoder->VorbisFile, 0)) Error("Decode", "Seek error in stream"); } return true; } else if (ret < 0) { return false; } } return true; } --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered. --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
At 07:42 AM 11/23/01 +0100, you wrote:>I think I have bumped into the small file error, or I''m doing something >stupid. The files are short audio effects for a game (embedded in our own >data format). > >Sample info: >Vorbis packets: 1 (4 kb) >Samples: 28672 >Samplerate: 22 kHz >Channels: 2 > >This is what I''m doing when I want to get a number of bytes from the stream: > >The problem is that ov_pcm_tell always returns 0. And so does ov_read (its >only one packet so EOF)It''s impossible to have a vorbis file containing greater than 0 zero samples with only 1 packet. You need a minimum of 5 packets. Whatever tool you used to produce the above is wrong. This bug was fixed in cvs a week or two ago - could you give that a try? Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
>It''s impossible to have a vorbis file containing greater than 0 zero samples >with only 1 packet. You need a minimum of 5 packets. Whatever tool you used >to produce the above is wrong. > >This bug was fixed in cvs a week or two ago - could you give that a try? >Oh, and seeking in a very small file like this is also sometimes broken (I _think_ only if you seek to very near the end, though I didn''t test that thoroughly). It was more broken in rc2, but is still broken in cvs. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> int StartOffset >ov_pcm_tell(&m_pDecoder->VorbisFile); > > if (StartOffset<0) > Error("Decode","Offset error"); > > // uninterleave samples > ret = ov_read(&m_pDecoder->VorbisFile,(char >*)_pData,_nBytes,0,2,1,&m_pDecoder->Section); > > int EndOffset >ov_pcm_tell(&m_pDecoder->VorbisFile); > if (EndOffset<0) > Error("Decode","Offset error"); > > if (EndOffset == StartOffset) > ++NumTimesNoData; > else > NumTimesNoData = 0; > > _nBytes -= EndOffset - StartOffset; > pData += EndOffset - StartOffset;And finally (I didn''t actually read the code before, this was silly of me) this code appears to be spectacularly wrong. Your ov_pcm_tell() calls are irrelevent and misleading, and you then advance the data pointer by the wrong amount anyway. You should be doing: ret = ov_read(...) if(ret < 0 ) { deal with error somehow... } else if (ret == 0) { EOF, do whatever you want here } else { _nBytes -= ret; pData += bytes; } Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Michael Smith wrote:> > >It''s impossible to have a vorbis file containing greater than 0 zero samples > >with only 1 packet. You need a minimum of 5 packets. Whatever tool you used > >to produce the above is wrong. > > > >This bug was fixed in cvs a week or two ago - could you give that a try? > > > > Oh, and seeking in a very small file like this is also sometimes brokenDoes that only occur with manual seeking or also with automatic seeking by vorbis functions like pcm_tell?> (I _think_ only if you seek to very near the end, though I didn''t test > that thoroughly). It was more broken in rc2, but is still broken in cvs. > > Michael > > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' > containing only the word ''unsubscribe'' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered.-- Olaf van der Spek Almere, Holland Olaf@XCC.TMFWeb.NL http://xccu.sourceforge.net/ http://xcc.tiberian.com/ --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
>> >> Oh, and seeking in a very small file like this is also sometimes broken > >Does that only occur with manual seeking or also with automatic seeking >by vorbis functions like pcm_tell?What do you mean by this? vorbisfile never seeks except on initial open (which doesn''t trigger this bug), and when you call a seek function. ov_pcm_tell() certainly doesn''t do any sort of I/O or seeking. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Michael Smith wrote:> > >> > >> Oh, and seeking in a very small file like this is also sometimes broken > > > >Does that only occur with manual seeking or also with automatic seeking > >by vorbis functions like pcm_tell? > > What do you mean by this? vorbisfile never seeks except on initial open > (which doesn''t trigger this bug), and when you call a seek function. > ov_pcm_tell() certainly doesn''t do any sort of I/O or seeking.I meant the seeking that is required for ov_pcm_tell() to work. I didn''t know it was done on open.> > Michael > > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' > containing only the word ''unsubscribe'' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered.-- Olaf van der Spek Almere, Holland Olaf@XCC.TMFWeb.NL http://xccu.sourceforge.net/ http://xcc.tiberian.com/ --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Fri, Nov 23, 2001 at 08:25:48PM +1100, Michael Smith wrote:> At 07:42 AM 11/23/01 +0100, you wrote: > >I think I have bumped into the small file error, or I''m doing something > >stupid. The files are short audio effects for a game (embedded in our own > >data format). > > > >Sample info: > >Vorbis packets: 1 (4 kb) > >Samples: 28672 > >Samplerate: 22 kHz > >Channels: 2 > > > >This is what I''m doing when I want to get a number of bytes from the stream: > > > >The problem is that ov_pcm_tell always returns 0. And so does ov_read (its > >only one packet so EOF) > > It''s impossible to have a vorbis file containing greater than 0 zero samples > with only 1 packet. You need a minimum of 5 packets. Whatever tool you used > to produce the above is wrong.Given that the ''packet'' is 4kB, I think he meant ''page''. Monty --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> >Given that the ''packet'' is 4kB, I think he meant ''page''. > > I thought that too, after I sent the message. But that''s also wrong, a > vorbis file contains a minimum of 3 pages (header1, header2+3, data). > It''s possible he meant "1 data page", I suppose.Technically a single page could contain all the packets, although I think the minimum acceptable by the yet-to-be-written-standard is 2 pages, since headers and non-headers must be on seperate pages. jack. --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> >Given that the ''packet'' is 4kB, I think he meant ''page''.I thought that too, after I sent the message. But that''s also wrong, a vorbis file contains a minimum of 3 pages (header1, header2+3, data). It''s possible he meant "1 data page", I suppose. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
The problem was with the encoding. I forgot to flush the vorbis codec before saving the file, so the files were missing a couple of packet at the end. The ov_pcm_tell was my attempt to work around what I thought was a bug in vorbisfile.. Now everything is peachy, except I crackle at the end of the samples, but that could be anything. -----Original Message----- From: Michael Smith [mailto:msmith@labyrinth.net.au] Sent: den 24 november 2001 03:24 To: vorbis-dev@xiph.org Subject: Re: [vorbis-dev] Small vorbis files with vorbisfile> >Given that the ''packet'' is 4kB, I think he meant ''page''.I thought that too, after I sent the message. But that''s also wrong, a vorbis file contains a minimum of 3 pages (header1, header2+3, data). It''s possible he meant "1 data page", I suppose. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered. --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
At 07:22 PM 11/23/01 -0700, you wrote:>> >Given that the ''packet'' is 4kB, I think he meant ''page''. >> >> I thought that too, after I sent the message. But that''s also wrong, a >> vorbis file contains a minimum of 3 pages (header1, header2+3, data). >> It''s possible he meant "1 data page", I suppose. > >Technically a single page could contain all the packets, although I >think the minimum acceptable by the yet-to-be-written-standard is 2 >pages, since headers and non-headers must be on seperate pages.The first packet also has to be in a seperate page. This is actually enforced by libogg. Michael --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Sat, Nov 24, 2001 at 03:50:56AM +0100, Erik Olofsson wrote:> The problem was with the encoding. I forgot to flush the vorbis codec before > saving the file, so the files were missing a couple of packet at the end. > The ov_pcm_tell was my attempt to work around what I thought was a bug in > vorbisfile.. > > Now everything is peachy, except I crackle at the end of the samples, but > that could be anything.If it''s rc2, I did find a bug in the post-last-frame extrapolator that could cause a crack. It''s fixed on my branch. Monty --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Would that be the encoder or the decoder?? I tried getting branch_monty_20011009, but the encoder is broken there. Can I get only a particular file to fix the crackling error?? When do you plan to release a new major release, with everything working? -----Original Message----- From: xiphmont@xiph.org [mailto:xiphmont@xiph.org] Sent: den 24 november 2001 07:36 To: vorbis-dev@xiph.org Subject: Re: [vorbis-dev] Small vorbis files with vorbisfile On Sat, Nov 24, 2001 at 03:50:56AM +0100, Erik Olofsson wrote:> The problem was with the encoding. I forgot to flush the vorbis codecbefore> saving the file, so the files were missing a couple of packet at the end. > The ov_pcm_tell was my attempt to work around what I thought was a bug in > vorbisfile.. > > Now everything is peachy, except I crackle at the end of the samples, but > that could be anything.If it''s rc2, I did find a bug in the post-last-frame extrapolator that could cause a crack. It''s fixed on my branch. Monty --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered. --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to ''vorbis-dev-request@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.