[vlc-commits] demux: ts: fixed duration probing
Jeremy Vignelles
git at videolan.org
Mon Jun 25 21:56:29 CEST 2018
vlc/vlc-3.0 | branch: master | Jeremy Vignelles <jeremy.vignelles at dev3i.fr> | Thu May 24 17:25:39 2018 +0200| [c60e89a838c9ab18c4b4ccfebdbf9a6b65889b98] | committer: Jean-Baptiste Kempf
demux: ts: fixed duration probing
Symptoms: I have a recorded .ts file that is around 15 seconds long for
testing.
VLC can play the stream fine, but the displayed duration is 10s.
When VLC reaches the end of the file, it seems to realize that there is
more data and increases the duration as the file plays.
Digging into ProbeEnd:
I digged into the code and found the ProbeEnd method.
It calls ProbeChunk, with output args (the pcr and a found boolean).
If pcr == -1, the previous chunk is taken, until PROBE_MAX is reached.
However, the i_pcr received from the ProbeChunk method is the pcr of the
last packet, and not the pcr of the last packet with a pcr.
It means that most of the time, the pcr is -1 and the previous chunk is
read, even though b_found is true.
What's the use of that condition? I removed it, please correct me if I'm
wrong.
The ProbeStart has the same suspicious condition, so I removed it too. I
also saw the suspicious `i_pos > 0` which is always false at the first
iteration.
Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>
(cherry picked from commit 584b75bbffe80818b929812652334c7be0b75b82)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c60e89a838c9ab18c4b4ccfebdbf9a6b65889b98
---
modules/demux/mpeg/ts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index f7c87a8531..549ea66c47 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -2103,7 +2103,7 @@ int ProbeStart( demux_t *p_demux, int i_program )
/* Go ahead one more chunk if end of file contained only stuffing packets */
i_probe_count += PROBE_CHUNK_COUNT;
- } while( i_pos > 0 && (i_pcr == -1 || !b_found) &&
+ } while( i_pos < i_stream_size && !b_found &&
i_probe_count < PROBE_MAX );
if( vlc_stream_Seek( p_sys->stream, i_initial_pos ) )
@@ -2135,7 +2135,7 @@ int ProbeEnd( demux_t *p_demux, int i_program )
/* Go ahead one more chunk if end of file contained only stuffing packets */
i_probe_count += PROBE_CHUNK_COUNT;
- } while( i_pos > 0 && (i_pcr == -1 || !b_found) &&
+ } while( i_pos > 0 && !b_found &&
i_probe_count < PROBE_MAX );
if( vlc_stream_Seek( p_sys->stream, i_initial_pos ) )
More information about the vlc-commits
mailing list