[vlc-commits] input: forward input_stats_t from INPUT_EVENT_STATISTICS events
Thomas Guillem
git at videolan.org
Thu Sep 6 10:28:41 CEST 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 6 10:13:32 2018 +0200| [3b5560e5f1626131e11abe3382cd6932d2880f28] | committer: Thomas Guillem
input: forward input_stats_t from INPUT_EVENT_STATISTICS events
Allow to fetch last input stats without holding the input_item_t lock.
It will be used by the future vlc_player.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b5560e5f1626131e11abe3382cd6932d2880f28
---
include/vlc_input.h | 2 ++
src/input/event.h | 4 +++-
src/input/input.c | 9 ++++++---
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 6b50929290..e8a12d0ff5 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -476,6 +476,8 @@ struct vlc_input_event
struct vlc_input_event_es es;
/* INPUT_EVENT_RECORD */
bool record;
+ /* INPUT_EVENT_STATISTICS */
+ const struct input_stats_t *stats;
/* INPUT_EVENT_SIGNAL */
struct vlc_input_event_signal signal;
/* INPUT_EVENT_AUDIO_DELAY */
diff --git a/src/input/event.h b/src/input/event.h
index 8aa2059b7e..3d3850019f 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -74,10 +74,12 @@ static inline void input_SendEventLength(input_thread_t *p_input,
});
}
-static inline void input_SendEventStatistics(input_thread_t *p_input)
+static inline void input_SendEventStatistics(input_thread_t *p_input,
+ const struct input_stats_t *stats)
{
input_SendEvent(p_input, &(struct vlc_input_event) {
.type = INPUT_EVENT_STATISTICS,
+ .stats = stats,
});
}
diff --git a/src/input/input.c b/src/input/input.c
index 2f6bb5f8ee..b33c74370e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -696,15 +696,18 @@ static void MainLoopStatistics( input_thread_t *p_input )
es_out_SetTimes( priv->p_es_out, f_position, i_time, i_length );
+ struct input_stats_t new_stats;
+ if( priv->stats != NULL )
+ input_stats_Compute( priv->stats, &new_stats );
+
/* update current bookmark */
vlc_mutex_lock( &priv->p_item->lock );
priv->bookmark.i_time_offset = i_time;
-
if( priv->stats != NULL )
- input_stats_Compute( priv->stats, priv->p_item->p_stats );
+ *priv->p_item->p_stats = new_stats;
vlc_mutex_unlock( &priv->p_item->lock );
- input_SendEventStatistics( p_input );
+ input_SendEventStatistics( p_input, &new_stats );
}
/**
More information about the vlc-commits
mailing list