[vlc-commits] access: bluray: don't restart decoder on seek
Francois Cartegnie
git at videolan.org
Tue Nov 13 16:42:32 CET 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 13 10:25:16 2018 +0100| [a860a872a9894cfb966516a437ed22e084f333a9] | committer: Francois Cartegnie
access: bluray: don't restart decoder on seek
video stream resync/vout can't be reused fast enough.
partial revert of 0160bec1b539b2df7766fc39873e304d2c761b29
(cherry picked from commit 160102bf195f128def1ec0fcea8d59b4aafd5df8)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a860a872a9894cfb966516a437ed22e084f333a9
---
modules/access/bluray.c | 45 +++++++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index fc13fd681d..337b4d88f8 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -223,6 +223,7 @@ typedef struct
es_out_id_t *p_es;
int i_next_block_flags;
bool b_recyling;
+ bool b_restart_decoders_on_reuse;
} es_pair_t;
static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
@@ -234,6 +235,7 @@ static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
p_pair->p_es = p_es;
p_pair->i_next_block_flags = 0;
p_pair->b_recyling = false;
+ p_pair->b_restart_decoders_on_reuse = true;
if(vlc_array_append(p_array, p_pair) != VLC_SUCCESS)
{
free(p_pair);
@@ -383,7 +385,7 @@ static int onMouseEvent(vlc_object_t *p_vout, const char *psz_var,
static int onIntfEvent(vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void *);
-static void blurayRestartParser(demux_t *p_demux, bool);
+static void blurayRestartParser(demux_t *p_demux, bool, bool);
static void notifyDiscontinuityToParser( demux_sys_t *p_sys );
#define FROM_TICKS(a) ((a)*CLOCK_FREQ / INT64_C(90000))
@@ -1120,6 +1122,7 @@ typedef struct
vlc_object_t *p_obj;
vlc_array_t es; /* es_pair_t */
bool b_entered_recycling;
+ bool b_restart_decoders_on_reuse;
void *priv;
bool b_discontinuity;
bool b_disable_output;
@@ -1141,6 +1144,7 @@ enum
BLURAY_ES_OUT_CONTROL_DISABLE_OUTPUT,
BLURAY_ES_OUT_CONTROL_ENABLE_LOW_DELAY,
BLURAY_ES_OUT_CONTROL_DISABLE_LOW_DELAY,
+ BLURAY_ES_OUT_CONTROL_RANDOM_ACCESS,
};
static es_out_id_t *bluray_esOutAdd(es_out_t *p_out, const es_format_t *p_fmt)
@@ -1194,7 +1198,9 @@ static es_out_id_t *bluray_esOutAdd(es_out_t *p_out, const es_format_t *p_fmt)
msg_Info(p_demux, "Reusing ES %d", p_fmt->i_id);
p_pair->b_recyling = false;
p_es = p_pair->p_es;
- if(!es_format_IsSimilar(&fmt, &p_pair->fmt))
+ if(!es_format_IsSimilar(p_fmt, &p_pair->fmt) ||
+ p_fmt->b_packetized != p_pair->fmt.b_packetized ||
+ esout_sys->b_restart_decoders_on_reuse)
{
es_out_Control(esout_sys->p_dst_out, ES_OUT_SET_ES_FMT, p_pair->p_es, &fmt);
es_format_Clean(&p_pair->fmt);
@@ -1226,7 +1232,9 @@ static void bluray_esOutDeleteNonReusedESUnlocked(es_out_t *p_out)
if(!esout_sys->b_entered_recycling)
return;
+
esout_sys->b_entered_recycling = false;
+ esout_sys->b_restart_decoders_on_reuse = true;
es_pair_t *p_pair;
while((p_pair = getUnusedEsPair(&esout_sys->es)))
@@ -1335,6 +1343,12 @@ static int bluray_esOutControl(es_out_t *p_out, int i_query, va_list args)
i_ret = VLC_SUCCESS;
} break;
+ case BLURAY_ES_OUT_CONTROL_RANDOM_ACCESS:
+ {
+ esout_sys->b_restart_decoders_on_reuse = !va_arg(args, int);
+ i_ret = VLC_SUCCESS;
+ } break;
+
case BLURAY_ES_OUT_CONTROL_ENABLE_OUTPUT:
case BLURAY_ES_OUT_CONTROL_DISABLE_OUTPUT:
{
@@ -1407,6 +1421,7 @@ static es_out_t *esOutNew(vlc_object_t *p_obj, es_out_t *p_dst_out, void *priv)
esout_sys->b_discontinuity = false;
esout_sys->b_disable_output = false;
esout_sys->b_entered_recycling = false;
+ esout_sys->b_restart_decoders_on_reuse = true;
esout_sys->b_lowdelay = false;
esout_sys->selected.i_audio_pid = -1;
esout_sys->selected.i_spu_pid = -1;
@@ -2047,7 +2062,7 @@ static void blurayInitTitles(demux_t *p_demux, uint32_t menu_titles)
}
}
-static void blurayRestartParser(demux_t *p_demux, bool b_flush)
+static void blurayRestartParser(demux_t *p_demux, bool b_flush, bool b_random_access)
{
/*
* This is a hack and will have to be removed.
@@ -2070,6 +2085,8 @@ static void blurayRestartParser(demux_t *p_demux, bool b_flush)
msg_Err(p_demux, "Failed to create TS demuxer");
es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_ENABLE_OUTPUT);
+
+ es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_RANDOM_ACCESS, b_random_access);
}
/*****************************************************************************
@@ -2205,7 +2222,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
p_demux->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
return VLC_EGENERIC;
}
- blurayRestartParser(p_demux, true);
+ blurayRestartParser(p_demux, true, false);
notifyDiscontinuityToParser(p_sys);
p_sys->b_draining = false;
es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
@@ -2216,7 +2233,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
{
int i_chapter = va_arg(args, int);
bd_seek_chapter(p_sys->bluray, i_chapter);
- blurayRestartParser(p_demux, true);
+ blurayRestartParser(p_demux, true, false);
notifyDiscontinuityToParser(p_sys);
p_sys->b_draining = false;
es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
@@ -2263,7 +2280,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
{
int64_t i_time = va_arg(args, int64_t);
bd_seek_time(p_sys->bluray, TO_TICKS(i_time));
- blurayRestartParser(p_demux, true);
+ blurayRestartParser(p_demux, true, true);
notifyDiscontinuityToParser(p_sys);
p_sys->b_draining = false;
es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
@@ -2293,7 +2310,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
{
double f_position = va_arg(args, double);
bd_seek_time(p_sys->bluray, TO_TICKS(f_position*CUR_LENGTH));
- blurayRestartParser(p_demux, true);
+ blurayRestartParser(p_demux, true, true);
notifyDiscontinuityToParser(p_sys);
p_sys->b_draining = false;
es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
@@ -2521,7 +2538,7 @@ static void blurayResetStillImage( demux_t *p_demux )
if (p_sys->i_still_end_time != STILL_IMAGE_NOT_SET) {
p_sys->i_still_end_time = STILL_IMAGE_NOT_SET;
- blurayRestartParser(p_demux, false);
+ blurayRestartParser(p_demux, false, false);
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
}
}
@@ -2590,7 +2607,7 @@ static void blurayUpdatePlaylist(demux_t *p_demux, unsigned i_playlist)
{
demux_sys_t *p_sys = p_demux->p_sys;
- blurayRestartParser(p_demux, true);
+ blurayRestartParser(p_demux, true, false);
/* read title info and init some values */
if (!p_sys->b_menu)
@@ -2632,7 +2649,7 @@ static void blurayOnClipUpdate(demux_t *p_demux, uint32_t clip)
{
if(p_sys->clip_application_type == BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW ||
clpi->clip.application_type == BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW)
- blurayRestartParser(p_demux, false);
+ blurayRestartParser(p_demux, false, false);
if(clpi->clip.application_type == BD_CLIP_APP_TYPE_TS_MAIN_PATH_TIMED_SLIDESHOW)
es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_ENABLE_LOW_DELAY);
@@ -2667,7 +2684,7 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
if (p_sys->b_pl_playing) {
/* previous playlist was stopped in middle. flush to avoid delay */
msg_Info(p_demux, "Stopping playlist playback");
- blurayRestartParser(p_demux, false);
+ blurayRestartParser(p_demux, false, false);
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
}
p_sys->b_pl_playing = true;
@@ -2691,7 +2708,7 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
but also BD-J initiated. We can't make the difference
between input or vm ones, better double flush/pcr reset
than break the clock by throwing post random access PCR */
- blurayRestartParser(p_demux, true);
+ blurayRestartParser(p_demux, true, true);
notifyDiscontinuityToParser(p_sys);
es_out_Control(p_sys->p_out, ES_OUT_RESET_PCR);
break;
@@ -2752,14 +2769,14 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
break;
case BD_EVENT_DISCONTINUITY:
/* reset demuxer (partially decoded PES packets must be dropped) */
- blurayRestartParser(p_demux, false);
+ blurayRestartParser(p_demux, false, true);
es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
break;
case BD_EVENT_END_OF_TITLE:
if(p_sys->b_pl_playing)
{
notifyDiscontinuityToParser(p_sys);
- blurayRestartParser(p_demux, false);
+ blurayRestartParser(p_demux, false, false);
p_sys->b_draining = true;
p_sys->b_pl_playing = false;
}
More information about the vlc-commits
mailing list