Commit 4efb2911 authored by Clément Stenac's avatar Clément Stenac

AccessOutWrite is called very often, especially for TS. Don't store stats on each call

parent 8d995e6f
......@@ -106,6 +106,10 @@ struct sout_access_out_t
char *psz_access;
sout_cfg_t *p_cfg;
int i_writes;
int64_t i_sent_bytes; ///< This is a "local" counter that is reset each
// time it is transferred to stats
char *psz_name;
sout_access_out_sys_t *p_sys;
int (*pf_seek)( sout_access_out_t *, off_t );
......
......@@ -309,6 +309,10 @@ sout_access_out_t *sout_AccessOutNew( sout_instance_t *p_sout,
p_access->pf_read = NULL;
p_access->pf_write = NULL;
p_access->p_module = NULL;
p_access->i_writes = 0;
p_access->i_sent_bytes = 0;
vlc_object_attach( p_access, p_sout );
p_access->p_module =
......@@ -367,21 +371,25 @@ int sout_AccessOutRead( sout_access_out_t *p_access, block_t *p_buffer )
int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
{
int i_total;
if( p_access->p_libvlc->b_stats )
p_access->i_writes++;
p_access->i_sent_bytes += p_buffer->i_buffer;
if( p_access->p_libvlc->b_stats && p_access->i_writes % 10 == 0 )
{
/* Access_out -> sout_instance -> input_thread_t */
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_access, VLC_OBJECT_INPUT,
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_access, VLC_OBJECT_INPUT,
FIND_PARENT );
if( p_input )
{
stats_UpdateInteger( p_input, "sout_sent_packets", 1 );
stats_UpdateInteger( p_input, "sout_sent_bytes",
p_buffer->i_buffer );
stats_GetInteger( p_input,
stats_UpdateInteger( p_input, "sout_sent_packets", 10 );
stats_UpdateInteger( p_input, "sout_sent_bytes",
p_access->i_sent_bytes );
stats_GetInteger( p_input,
p_access->p_parent->p_parent->i_object_id,
"sout_sent_bytes", &i_total );
stats_UpdateFloat( p_input, "sout_send_bitrate", (float)i_total );
p_access->i_sent_bytes = 0;
vlc_object_release( p_input );
}
}
......
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