ok, tried it out... passes test/test_seeking.sh and my "xmms twitch" test, checked in to CVS. thanks! Josh --- Miroslav Lichvar <lichvarm@phoenix.inf.upol.cz> wrote:> On Fri, Nov 03, 2006 at 10:01:42AM +0100, Miroslav Lichvar wrote: > > Thanks. Sending latest version of the patch. Now it can seek in > files > > that have large id3 tag (or any random data) at the end and it > won't loop on > > streams with shuffled frames. > > One small patch on top of that and it's bug free. ;) > > -- > Miroslav Lichvar > > --- flac/src/libFLAC/stream_decoder.c.orig 2006-11-03 > 18:52:38.104291323 +0100 > +++ flac/src/libFLAC/stream_decoder.c 2006-11-03 18:53:41.350727144 > +0100 > @@ -2995,7 +2995,7 @@ > > while(1) { > /* check if the bounds are still ok */ > - if (lower_bound_sample + FLAC__MIN_BLOCK_SIZE > upper_bound_sample > || lower_bound > upper_bound) { > + if (lower_bound_sample >= upper_bound_sample || lower_bound > > upper_bound) { > decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; > return false; > } >____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail. http://new.mail.yahoo.com
On Mon, Nov 06, 2006 at 08:50:44AM -0800, Josh Coalson wrote:> ok, tried it out... passes test/test_seeking.sh and my > "xmms twitch" test, checked in to CVS. thanks!Thanks! I see you have changed the channels and bps setting, this doesn't work when the decoder hasn't decoded a frame. There should be a fallback for this case. -- Miroslav Lichvar -------------- next part -------------- Index: stream_decoder.c ==================================================================RCS file: /cvsroot/flac/flac/src/libFLAC/stream_decoder.c,v retrieving revision 1.119 diff -u -r1.119 stream_decoder.c --- stream_decoder.c 6 Nov 2006 16:48:33 -0000 1.119 +++ stream_decoder.c 7 Nov 2006 09:13:30 -0000 @@ -2935,10 +2935,16 @@ const unsigned max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize; const unsigned min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize; /* take these from the current frame in case they've changed mid-stream */ - const unsigned channels = FLAC__stream_decoder_get_channels(decoder); - const unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder); + unsigned channels = FLAC__stream_decoder_get_channels(decoder); + unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder); const FLAC__StreamMetadata_SeekTable *seek_table = decoder->private_->has_seek_table? &decoder->private_->seek_table.data.seek_table : 0; + /* use values from stream info if we didn't decode a frame */ + if (channels == 0) + channels = decoder->private_->stream_info.data.stream_info.channels; + if (bps == 0) + bps = decoder->private_->stream_info.data.stream_info.bits_per_sample; + /* we are just guessing here */ if(max_framesize > 0) approx_bytes_per_frame = (max_framesize + min_framesize) / 2 + 1;
--- Miroslav Lichvar <lichvarm@phoenix.inf.upol.cz> wrote:> On Mon, Nov 06, 2006 at 08:50:44AM -0800, Josh Coalson wrote: > > ok, tried it out... passes test/test_seeking.sh and my > > "xmms twitch" test, checked in to CVS. thanks! > > Thanks! > > I see you have changed the channels and bps setting, this doesn't > work > when the decoder hasn't decoded a frame. There should be a fallback > for this case.ah, yes... this was a question I was going to ask you about the patch... I used the channels/bps from the latest frame to try and keep it working even for streams where they change in mid stream. even though I don't know of anything that does this, in the streaming case it could happen, and there might not be any STREAMINFO or it might be incorrect. I was going to change it further down also when approx_bytes_per_frame is recalculated but couldn't tell if this would make the algorithm unstable (not converge). maybe it's best to not try and solve that case though. Josh ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail. http://new.mail.yahoo.com