# HG changeset patch # User mosu # Date 1041238773 0 # Node ID f8e53f8cb8b2c55b18f5f1bbe4ec92d261b610f9 # Parent 2c4cebb8637d2e192705b60792b525be00c1345f bunkus: Fixed Ogg/Ogm seeking by discarding the first packet after the seek which may be incomplete diff -r 2c4cebb8637d -r f8e53f8cb8b2 libmpdemux/demux_ogg.c --- a/libmpdemux/demux_ogg.c Mon Dec 30 01:34:20 2002 +0000 +++ b/libmpdemux/demux_ogg.c Mon Dec 30 08:59:33 2002 +0000 @@ -901,7 +901,7 @@ 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 @@ 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 @@ 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);