[vlc-devel] [PATCH] decoder: always rebase clock of pts only packets
Francois Cartegnie
fcvlcdev at free.fr
Sun Apr 22 12:38:28 CEST 2018
In case of missing pts, the clock is not rebase to
system clock which then breaks when mixed with other streams.
Ex: rtsp video has no dts, but audio has since this is pts.
---
src/input/decoder.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 98817e6f39..8ab09f6aa3 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -781,6 +781,7 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
const bool b_ephemere = pi_ts1 && *pi_ts0 == *pi_ts1;
int i_rate;
+ int i_ret;
if( *pi_ts0 > VLC_TS_INVALID )
{
*pi_ts0 += i_es_delay;
@@ -788,21 +789,33 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
*pi_ts1 += i_es_delay;
if( i_ts_bound != INT64_MAX )
i_ts_bound += i_es_delay;
- if( input_clock_ConvertTS( VLC_OBJECT(p_dec), p_clock, &i_rate, pi_ts0, pi_ts1, i_ts_bound ) ) {
- const char *psz_name = module_get_name( p_dec->p_module, false );
- if( pi_ts1 != NULL )
- msg_Err(p_dec, "Could not convert timestamps %"PRId64
- ", %"PRId64" for %s", *pi_ts0, *pi_ts1, psz_name );
- else
- msg_Err(p_dec, "Could not convert timestamp %"PRId64" for %s", *pi_ts0, psz_name );
- *pi_ts0 = VLC_TS_INVALID;
- }
+ i_ret = input_clock_ConvertTS( VLC_OBJECT(p_dec), p_clock, &i_rate, pi_ts0, pi_ts1, i_ts_bound );
+ }
+ else if( pi_ts1 && *pi_ts1 > VLC_TS_INVALID )
+ {
+ i_ret = input_clock_ConvertTS( VLC_OBJECT(p_dec), p_clock, &i_rate, pi_ts1, NULL, i_ts_bound );
}
else
{
+ i_ret = 0;
i_rate = input_clock_GetRate( p_clock );
}
+ if( i_ret != 0 )
+ {
+ const char *psz_name = module_get_name( p_dec->p_module, false );
+ if( pi_ts1 != NULL )
+ {
+ msg_Err(p_dec, "Could not convert timestamps %"PRId64
+ ", %"PRId64" for %s", *pi_ts0, *pi_ts1, psz_name );
+ *pi_ts1 = VLC_TS_INVALID;
+ pi_ts1 = NULL; /* to skip rounding check */
+ }
+ else
+ msg_Err(p_dec, "Could not convert timestamp %"PRId64" for %s", *pi_ts0, psz_name );
+ *pi_ts0 = VLC_TS_INVALID;
+ }
+
/* Do not create ephemere data because of rounding errors */
if( !b_ephemere && pi_ts1 && *pi_ts0 == *pi_ts1 )
*pi_ts1 += 1;
--
2.14.3
More information about the vlc-devel
mailing list