Commit 52b8f845 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.

(cherry picked from commit 895d480b516f01482df7176ccee811c38d665230)
parent 40ac6bfe
......@@ -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