[vlc-devel] [PATCH 04/17] vout: spu: handle when the vlc_clock is reset
Thomas Guillem
thomas at gllm.fr
Mon Feb 15 10:14:59 UTC 2021
Abort spu rendering when the main clock is reset (the master ES is
flushed).
---
src/video_output/vout_subpictures.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index a2e9072dab6..4f2ba2a8596 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -612,8 +612,16 @@ static size_t spu_channel_UpdateDates(struct spu_channel *channel,
/* Convert all spu ts */
if (channel->clock)
- vlc_clock_ConvertArrayToSystem(channel->clock, system_now, date_array,
- channel->entries.size * 2, channel->rate);
+ {
+ int ret = vlc_clock_ConvertArrayToSystem(channel->clock, system_now,
+ date_array, channel->entries.size * 2,
+ channel->rate);
+ if (unlikely(ret != VLC_SUCCESS))
+ {
+ free(date_array);
+ return 0;
+ }
+ }
/* Put back the converted ts into the output spu_render_entry_t struct */
for (size_t index = 0; index < channel->entries.size; index++)
@@ -1875,8 +1883,14 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
{
vlc_tick_t system_now = vlc_tick_now();
vlc_tick_t times[2] = { orgstart, orgstop };
- vlc_clock_ConvertArrayToSystem(channel->clock, system_now,
- times, 2, channel->rate);
+ int ret = vlc_clock_ConvertArrayToSystem(channel->clock, system_now,
+ times, 2, channel->rate);
+ if (ret != VLC_SUCCESS)
+ {
+ vlc_mutex_unlock(&sys->lock);
+ subpicture_Delete(subpic);
+ return;
+ }
subpic->i_start = times[0];
subpic->i_stop = times[1];
}
--
2.30.0
More information about the vlc-devel
mailing list