Commit 895d480b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_strfinput: fix race on input_item_t.p_stats

p_stats is written with the input item lock (by the input thread).
Thus the input item lock is necessary to read and dereference p_stats.
parent 7bac48bd
......@@ -589,12 +589,19 @@ char *vlc_strfinput(input_thread_t *input, const char *s)
write_meta(stream, item, vlc_meta_EncodedBy);
break;
case 'f':
if (item != NULL && item->p_stats != NULL)
if (item != NULL)
{
vlc_mutex_lock(&item->p_stats->lock);
vlc_memstream_printf(stream, "%"PRIi64,
vlc_mutex_lock(&item->lock);
if (item->p_stats != NULL)
{
vlc_mutex_lock(&item->p_stats->lock);
vlc_memstream_printf(stream, "%"PRIi64,
item->p_stats->i_displayed_pictures);
vlc_mutex_unlock(&item->p_stats->lock);
vlc_mutex_unlock(&item->p_stats->lock);
}
else if (!b_empty_if_na)
vlc_memstream_putc(stream, '-');
vlc_mutex_unlock(&item->lock);
}
else if (!b_empty_if_na)
vlc_memstream_putc(stream, '-');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment