- libvorbis-1.2.2-svn16228.patch: Backport a fix from pre-1.2.3 to

hopefully fix small sound file playback. (#505610)
This commit is contained in:
Adam Jackson 2009-07-08 19:13:16 +00:00
parent 32532a35f4
commit ac8431f32c
2 changed files with 100 additions and 1 deletions

View File

@ -0,0 +1,92 @@
diff -up libvorbis-1.2.2/lib/vorbisfile.c.jx libvorbis-1.2.2/lib/vorbisfile.c
--- libvorbis-1.2.2/lib/vorbisfile.c.jx 2009-06-04 01:06:07.000000000 -0400
+++ libvorbis-1.2.2/lib/vorbisfile.c 2009-07-08 15:04:58.000000000 -0400
@@ -675,8 +675,13 @@ static int _fetch_and_process_packet(Ogg
/* extract packets from page */
while(1){
- /* process a packet if we can. If the machine isn't loaded,
- neither is a page */
+ if(vf->ready_state==STREAMSET){
+ int ret=_make_decode_ready(vf);
+ if(ret<0)return ret;
+ }
+
+ /* process a packet if we can. */
+
if(vf->ready_state==INITSET){
while(1) {
ogg_packet op;
@@ -844,11 +849,6 @@ static int _fetch_and_process_packet(Ogg
link=0;
}
}
-
- {
- int ret=_make_decode_ready(vf);
- if(ret<0)return ret;
- }
}
/* the buffered page is the data we want, and we're ready for it;
@@ -1255,7 +1255,9 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_i
int lastblock=0;
int accblock=0;
int thisblock=0;
- int eosflag=0;
+ int lastflag=0;
+ int firstflag=0;
+ ogg_int64_t pagepos=-1;
ogg_stream_init(&work_os,vf->current_serialno); /* get the memory ready */
ogg_stream_reset(&work_os); /* eliminate the spurious OV_HOLE
@@ -1276,7 +1278,14 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_i
thisblock=0;
}else{
- if(eosflag)
+ /* We can't get a guaranteed correct pcm position out of the
+ last page in a stream because it might have a 'short'
+ granpos, which can only be detected in the presence of a
+ preceeding page. However, if the last page is also the first
+ page, the granpos rules of a first page take precedence. Not
+ only that, but for first==last, the EOS page must be treated
+ as if its a normal first page for the stream to open/play. */
+ if(lastflag && !firstflag)
ogg_stream_packetout(&vf->os,NULL);
else
if(lastblock)accblock+=(lastblock+thisblock)>>2;
@@ -1290,6 +1299,7 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_i
for(i=0;i<link;i++)
granulepos+=vf->pcmlengths[i*2+1];
vf->pcm_offset=granulepos-accblock;
+ if(vf->pcm_offset<0)vf->pcm_offset=0;
break;
}
lastblock=thisblock;
@@ -1300,7 +1310,8 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_i
}
if(!lastblock){
- if(_get_next_page(vf,&og,-1)<0){
+ pagepos=_get_next_page(vf,&og,-1);
+ if(pagepos<0){
vf->pcm_offset=ov_pcm_total(vf,-1);
break;
}
@@ -1341,12 +1352,13 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_i
ogg_stream_reset_serialno(&vf->os,serialno);
ogg_stream_reset_serialno(&work_os,serialno);
vf->ready_state=STREAMSET;
-
+ firstflag=(pagepos<=vf->dataoffsets[link]);
}
ogg_stream_pagein(&vf->os,&og);
ogg_stream_pagein(&work_os,&og);
- eosflag=ogg_page_eos(&og);
+ lastflag=ogg_page_eos(&og);
+
}
}

View File

@ -1,7 +1,7 @@
Summary: The Vorbis General Audio Compression Codec.
Name: libvorbis
Version: 1.2.2
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
Group: System Environment/Libraries
License: BSD
@ -10,6 +10,8 @@ Source: http://downloads.xiph.org/releases/vorbis/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libogg-devel >= 2:1.1
Patch0: libvorbis-1.2.2-svn16228.patch
%description
Ogg Vorbis is a fully open, non-proprietary, patent- and royalty-free,
general-purpose compressed audio format for audio and music at fixed
@ -40,6 +42,7 @@ Documentation for developing applications with libvorbis.
%prep
%setup -q
%patch0 -p1 -b .svn
sed -i "s/-O20/$RPM_OPT_FLAGS/" configure
sed -i "s/-ffast-math//" configure
@ -82,6 +85,10 @@ rm -rf $RPM_BUILD_ROOT
%postun -p /sbin/ldconfig
%changelog
* Wed Jul 08 2009 Adam Jackson <ajax@redhat.com> 1.2.2-2
- libvorbis-1.2.2-svn16228.patch: Backport a fix from pre-1.2.3 to hopefully
fix small sound file playback. (#505610)
* Thu Jul 02 2009 Adam Jackson <ajax@redhat.com> 1.2.2-1
- libvorbis 1.2.2