0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

bunkus: Fixed Ogg/Ogm seeking by discarding the first packet after the seek which may be incomplete

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8656 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
mosu 2002-12-30 08:59:33 +00:00
parent ac3b6c6552
commit 673897aa36

View File

@ -901,7 +901,7 @@ void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
sh_audio_t* sh_audio = demuxer->audio->sh;
ogg_packet op;
float rate;
int i,sp;
int i,sp,first;
vorbis_info* vi = NULL;
int64_t gp = 0;
off_t pos;
@ -961,6 +961,7 @@ void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
ogg_d->pos = pos;
ogg_d->last_size = 0;
first = 1;
while(1) {
int np;
ogg_d->pos += ogg_d->last_size;
@ -992,7 +993,13 @@ void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
continue;
else if(np == 0)
break;
if (first) { /* Discard the first packet as it's probably broken,
and we don't have any other means to decide whether it is
complete or not. */
first = 0;
break;
}
if( ((*op.packet & PACKET_IS_SYNCPOINT) || os->vorbis ) &&
(!ogg_d->syncpoints || op.granulepos >= gp) ) {
demux_ogg_add_packet(ds,os,&op);