[MPlayer-dev-eng] Fw: Endless loop with -hr-edl-seek

Oded Shimon ods15 at ods15.dyndns.org
Sun May 22 21:33:56 CEST 2005


Bug in -hr-edl-seek.

- ods15


----- Forwarded message from Thorsten Pferdek?mper <thorsten-mailbox at thorsten-pferdekaemper.de> -----

From: Thorsten Pferdek?mper <thorsten-mailbox at thorsten-pferdekaemper.de>
To: MEncoder usage discussions <mencoder-users at mplayerhq.hu>
Subject: Re: [MEncoder-users] Endless loop with -hr-edl-seek
Date: Sun, 22 May 2005 13:53:13 +0200

On Friday 20 May 2005 07:16, Oded Shimon wrote:
> On Thu, May 19, 2005 at 08:41:31PM +0200, Thorsten Pferdek?mper wrote:
> > Hi,
> > this is perhaps not that important, but it is a little but ugly, because
> > mencoder stops reacting at all.
> > I reencoded a file with mencoder using edl and -hr-edl-seek. The file had
> > sound, but the sound was a little bit shorter than the video. The edl did
> > cut off the last few minutes of the video.
> > In this case, mencoder seems always to enter an endless loop.
> > I had a close look at the coding and here is my idea why this is like
> > that: In mencoder.c, function edl_seek, the loop which resyncs audio
> > checks the variable a_pts. When there is no audio left (I assume), this
> > variable does not change any more. Perhaps the loop should be left if
> > a_pts stops changing...
>
> You're right. Does this fix it?
>
> - ods15

Hi Oded,
I have looked at your patch and also used it. Both the "code review" and the 
test was successful.
Regards,
	Thorsten

_______________________________________________
MEncoder-users mailing list
MEncoder-users at mplayerhq.hu
http://mplayerhq.hu/mailman/listinfo/mencoder-users

----- End forwarded message -----
-------------- next part --------------
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.282
diff -u -r1.282 mencoder.c
--- mencoder.c	7 May 2005 14:50:14 -0000	1.282
+++ mencoder.c	20 May 2005 05:14:07 -0000
@@ -1597,15 +1597,16 @@
         if (sh_audio) {
             a_pts = d_audio->pts + (ds_tell_pts(d_audio) - sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
             while (sh_video->pts > a_pts) {
+                int len;
                 if (mux_a->h.dwSampleSize) {
-                    int len;
                     len = mux_a->wf->nAvgBytesPerSec * (sh_video->pts - a_pts);
                     len/= mux_a->h.dwSampleSize; if(len<1) len=1;
                     len*= mux_a->h.dwSampleSize;
-                    demux_read_data(sh_audio->ds,mux_a->buffer,len);
+                    len = demux_read_data(sh_audio->ds,mux_a->buffer,len);
                 } else {
-                    ds_get_packet(sh_audio->ds,(unsigned char**) &mux_a->buffer);
+                    len = ds_get_packet(sh_audio->ds,(unsigned char**) &mux_a->buffer);
                 }
+                if (len <= 0) break; // EOF of audio.
                 a_pts = d_audio->pts + (ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
             }
         }


More information about the MPlayer-dev-eng mailing list