[MPlayer-advusers] mplayer aborts with -nosound
Bob Bell
b_mplayer at thebellsplace.com
Sat Feb 9 21:48:36 CET 2008
On Sat, Feb 09, 2008 at 01:36:50PM -0500, Bob Bell wrote:
>On Sat, Feb 09, 2008 at 12:16:23PM +0100, Nico Sabbi wrote:
>>An easier fix consists in raising TIMESTAMP_PROBE_LEN a bit
>>(1M for example). Does it work?
>
>It does indeed.
It did some extra poking. The demuxer looks for a series of three
timestamps at three spots: the beginning of the file, the middle of the
file, and the end of the file. At the beginning there's no problem.
However, for my primary test in the middle the timestamps are at offsets
of 215040, 583680, and 931840 bytes. Bumping to TIMESTAMP_PROBE_LEN
therefore *barely* catches this case.
I was thinking, might it not make more sense to reset the probe length
every time a timestamp was found? The patch below implements that and
also works with my testing.
-- Bob
Index: libmpdemux/demux_mpg.c
===================================================================
--- libmpdemux/demux_mpg.c (revision 25959)
+++ libmpdemux/demux_mpg.c (working copy)
@@ -103,8 +103,11 @@
return 1;
}
-// 500000 is a wild guess
-#define TIMESTAMP_PROBE_LEN 500000
+//MAX_PTS_INTERVAL denotes the maximum number of bytes
+//to probe for the next pts
+//500000 is a wild guess
+#define MAX_PTS_INTERVAL 500000
+#define TIMESTAMP_PROBE_LEN (3*MAX_PTS_INTERVAL)
//MAX_PTS_DIFF_FOR_CONSECUTIVE denotes the maximum difference
//between two pts to consider them consecutive
@@ -123,6 +126,7 @@
float found_pts2; //the pts found before found_pts1
float found_pts3; //the pts found before found_pts2
int found = 0;
+ off_t end_of_probe;
if(!mpg_d || stream_pos < 0)
return pts;
@@ -135,10 +139,11 @@
//Therefore, we seek until we found three consecutive
//pts within MAX_PTS_DIFF_FOR_CONSECUTIVE.
+ end_of_probe = stream_pos + MAX_PTS_INTERVAL;
while(found<3 && !s->eof
&& (fabsf(found_pts2-found_pts1) < MAX_PTS_DIFF_FOR_CONSECUTIVE)
&& (fabsf(found_pts3-found_pts2) < MAX_PTS_DIFF_FOR_CONSECUTIVE)
- && (stream_tell(s) < stream_pos + TIMESTAMP_PROBE_LEN)
+ && (stream_tell(s) < end_of_probe)
&& ds_fill_buffer(demuxer->video))
{
if(mpg_d->last_pts != found_pts1)
@@ -152,6 +157,7 @@
found_pts1 = mpg_d->last_pts;
}
found++;
+ end_of_probe = stream_tell(s) + MAX_PTS_INTERVAL;
}
}
More information about the MPlayer-advusers
mailing list