CVS: main/libmpdemux demux_audio.c,1.29,1.30
CVS change done by Reimar Döffinger CVS Update of /cvsroot/mplayer/main/libmpdemux In directory mail:/var2/tmp/cvs-serv12427/libmpdemux Modified Files: demux_audio.c Log Message: Fix possible hang when playing broken MP3 from linear stream and remove duplicate code. Index: demux_audio.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- demux_audio.c 28 Sep 2004 17:05:44 -0000 1.29 +++ demux_audio.c 29 Jan 2005 12:55:56 -0000 1.30 @@ -364,6 +364,8 @@ int demux_audio_fill_buffer(demux_stream_t *ds) { + int l; + demux_packet_t* dp; sh_audio_t* sh_audio; demuxer_t* demux; da_priv_t* priv; @@ -383,52 +385,47 @@ switch(priv->frmt) { case MP3 : - while(! s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end) ) { + while(1) { uint8_t hdr[4]; - int len; stream_read(s,hdr,4); - len = mp_decode_mp3_header(hdr); - if(len < 0) { + if (s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end)) + return 0; + l = mp_decode_mp3_header(hdr); + if(l < 0) { stream_skip(s,-3); } else { - demux_packet_t* dp; - if(s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end) ) - return 0; - dp = new_demux_packet(len); + dp = new_demux_packet(l); memcpy(dp->buffer,hdr,4); - stream_read(s,dp->buffer + 4,len-4); - priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + 1152/(float)sh_audio->samplerate; - ds->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - ds_add_packet(ds,dp); - return 1; + stream_read(s,dp->buffer + 4,l-4); + break; } } break; case WAV : { - int l = sh_audio->wf->nAvgBytesPerSec; - demux_packet_t* dp = new_demux_packet(l); + l = sh_audio->wf->nAvgBytesPerSec; + dp = new_demux_packet(l); l = stream_read(s,dp->buffer,l); - resize_demux_packet(dp, l); - priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; - ds->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - ds_add_packet(ds,dp); - return 1; + break; } case fLaC: { - int l = 65535; - demux_packet_t* dp = new_demux_packet(l); + l = 65535; + dp = new_demux_packet(l); l = stream_read(s,dp->buffer,l); - resize_demux_packet(dp, l); - priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; - ds->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - ds_add_packet(ds,dp); - return 1; + break; } default: printf("Audio demuxer : unknown format %d\n",priv->frmt); + return 0; } - - return 0; + resize_demux_packet(dp, l); + if (priv->last_pts < 0) + priv->last_pts = 0; + else + priv->last_pts += l/(float)sh_audio->i_bps; + ds->pts = priv->last_pts - (ds_tell_pts(demux->audio) - + sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + ds_add_packet(ds, dp); + return 1; } static void high_res_mp3_seek(demuxer_t *demuxer,float time) {
On Sat, Jan 29, 2005 at 01:55:58PM +0100, Reimar Döffinger CVS wrote:
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libmpdemux In directory mail:/var2/tmp/cvs-serv12427/libmpdemux
Modified Files: demux_audio.c Log Message: Fix possible hang when playing broken MP3 from linear stream and remove duplicate code.
10l, this patch breaks seeking with -ac mad and -hr-mp3-seek (First seek fails; if backwards it goes to beginning of file, forwards sets pts=infinity permenantly..) Please try to find the cause soon and fix it or I'll reverse this. Rich
On Thu, Mar 03, 2005 at 08:43:22PM -0500, D Richard Felker III wrote:
On Sat, Jan 29, 2005 at 01:55:58PM +0100, Reimar Döffinger CVS wrote:
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libmpdemux In directory mail:/var2/tmp/cvs-serv12427/libmpdemux
Modified Files: demux_audio.c Log Message: Fix possible hang when playing broken MP3 from linear stream and remove duplicate code.
10l, this patch breaks seeking with -ac mad and -hr-mp3-seek (First seek fails; if backwards it goes to beginning of file, forwards sets pts=infinity permenantly..)
Please try to find the cause soon and fix it or I'll reverse this.
Fixed. 100l, actually. :) Rich
On Thu, Mar 03, 2005 at 08:59:31PM -0500, D Richard Felker III wrote:
On Thu, Mar 03, 2005 at 08:43:22PM -0500, D Richard Felker III wrote:
On Sat, Jan 29, 2005 at 01:55:58PM +0100, Reimar Döffinger CVS wrote:
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libmpdemux In directory mail:/var2/tmp/cvs-serv12427/libmpdemux
Modified Files: demux_audio.c Log Message: Fix possible hang when playing broken MP3 from linear stream and remove duplicate code.
10l, this patch breaks seeking with -ac mad and -hr-mp3-seek (First seek fails; if backwards it goes to beginning of file, forwards sets pts=infinity permenantly..)
Please try to find the cause soon and fix it or I'll reverse this.
Fixed. 100l, actually. :)
BTW, this is why we say never mix cosmetic changes with bugfixes. Your "cosmetic" change actually had an error in it, and finding it took a good bit of work. Rich
Hi,
Fixed. 100l, actually. :)
BTW, this is why we say never mix cosmetic changes with bugfixes. Your "cosmetic" change actually had an error in it, and finding it took a good bit of work.
Sorry if I did that - but I actually I think it was neccessary to avoid bloating that code part even further - but I admit I don't remember too well... Greetings, Reimar Döffinger
participants (3)
-
D Richard Felker III -
Reimar Döffinger -
syncmail@mplayerhq.hu