Commit a838001a authored by Clément Stenac's avatar Clément Stenac

Gather some sout stats (Refs:#473)

parent 7b053f54
...@@ -315,6 +315,11 @@ struct input_stats_t ...@@ -315,6 +315,11 @@ struct input_stats_t
int i_displayed_pictures; int i_displayed_pictures;
int i_lost_pictures; int i_lost_pictures;
/* Sout */
int i_sent_packets;
int i_sent_bytes;
float f_send_bitrate;
/* Aout */ /* Aout */
int i_played_abuffers; int i_played_abuffers;
int i_lost_abuffers; int i_lost_abuffers;
......
...@@ -197,6 +197,27 @@ InputStatsInfoPanel::InputStatsInfoPanel( intf_thread_t *_p_intf, ...@@ -197,6 +197,27 @@ InputStatsInfoPanel::InputStatsInfoPanel( intf_thread_t *_p_intf,
video_bsizer->Layout(); video_bsizer->Layout();
sizer->Add( video_bsizer , 0, wxALL| wxGROW, 5 ); sizer->Add( video_bsizer , 0, wxALL| wxGROW, 5 );
/* Sout */
wxStaticBox *sout_box = new wxStaticBox( this, -1,
wxU( _("Streaming" ) ) );
sout_box->SetAutoLayout( TRUE );
sout_bsizer = new wxStaticBoxSizer( sout_box, wxVERTICAL );
sout_sizer = new wxFlexGridSizer( 2,3, 20 );
#define SOUT_ADD(txt,widget,dflt) \
{ sout_sizer->Add ( new wxStaticText( this, -1, wxU(_( txt ) ) ), \
0, wxEXPAND|wxLEFT|wxALIGN_LEFT , 5 ); \
widget = new wxStaticText( this, -1, wxU( dflt ) ); \
sout_sizer->Add( widget, 0, wxEXPAND|wxRIGHT|wxALIGN_RIGHT, 5 ); \
}
SOUT_ADD( "Sent packets", sout_sent_packets_text, "0" );
SOUT_ADD( "Sent bytes", sout_sent_bytes_text, "0 " );
SOUT_ADD( "Send rate", sout_send_bitrate_text, "0 " );
sout_sizer->Layout();
sout_bsizer->Add( sout_sizer, 0, wxALL | wxGROW, 5 );
sout_bsizer->Layout();
sizer->Add( sout_bsizer , 0, wxALL| wxGROW, 5 );
/* Aout */ /* Aout */
wxStaticBox *audio_box = new wxStaticBox( this, -1, wxStaticBox *audio_box = new wxStaticBox( this, -1,
wxU( _("Audio" ) ) ); wxU( _("Audio" ) ) );
...@@ -215,12 +236,9 @@ InputStatsInfoPanel::InputStatsInfoPanel( intf_thread_t *_p_intf, ...@@ -215,12 +236,9 @@ InputStatsInfoPanel::InputStatsInfoPanel( intf_thread_t *_p_intf,
AUDIO_ADD( "Played buffers", played_abuffers_text, AUDIO_ADD( "Played buffers", played_abuffers_text,
"0 " ); "0 " );
AUDIO_ADD( "Lost buffers", lost_abuffers_text, "0" ); AUDIO_ADD( "Lost buffers", lost_abuffers_text, "0" );
audio_sizer->Layout(); audio_sizer->Layout();
audio_bsizer->Add( audio_sizer, 0, wxALL | wxGROW, 5 ); audio_bsizer->Add( audio_sizer, 0, wxALL | wxGROW, 5 );
audio_bsizer->Layout(); audio_bsizer->Layout();
sizer->AddSpacer( 0 );
sizer->Add( audio_bsizer , 0, wxALL| wxGROW, 5 ); sizer->Add( audio_bsizer , 0, wxALL| wxGROW, 5 );
sizer->Layout(); sizer->Layout();
...@@ -254,6 +272,14 @@ void InputStatsInfoPanel::Update( input_item_t *p_item ) ...@@ -254,6 +272,14 @@ void InputStatsInfoPanel::Update( input_item_t *p_item )
UPDATE( displayed_text, "%5i", p_item->p_stats->i_displayed_pictures ); UPDATE( displayed_text, "%5i", p_item->p_stats->i_displayed_pictures );
UPDATE( lost_frames_text, "%5i", p_item->p_stats->i_lost_pictures ); UPDATE( lost_frames_text, "%5i", p_item->p_stats->i_lost_pictures );
/* Sout */
UPDATE( sout_sent_packets_text, "%5i", p_item->p_stats->i_sent_packets );
UPDATE( sout_sent_bytes_text, "%8.0f kB",
(float)(p_item->p_stats->i_sent_bytes)/1000 );
UPDATE( sout_send_bitrate_text, "%6.0f kB/S",
(float)(p_item->p_stats->f_send_bitrate)*1000 );
/* Audio*/
UPDATE( audio_decoded_text, "%5i", p_item->p_stats->i_decoded_audio ); UPDATE( audio_decoded_text, "%5i", p_item->p_stats->i_decoded_audio );
UPDATE( played_abuffers_text, "%5i", p_item->p_stats->i_played_abuffers ); UPDATE( played_abuffers_text, "%5i", p_item->p_stats->i_played_abuffers );
UPDATE( lost_abuffers_text, "%5i", p_item->p_stats->i_lost_abuffers ); UPDATE( lost_abuffers_text, "%5i", p_item->p_stats->i_lost_abuffers );
......
...@@ -97,6 +97,12 @@ private: ...@@ -97,6 +97,12 @@ private:
wxStaticText *displayed_text; wxStaticText *displayed_text;
wxStaticText *lost_frames_text; wxStaticText *lost_frames_text;
wxFlexGridSizer *sout_sizer;
wxStaticBoxSizer *sout_bsizer;
wxStaticText *sout_sent_packets_text;
wxStaticText *sout_sent_bytes_text;
wxStaticText *sout_send_bitrate_text;
wxFlexGridSizer *audio_sizer; wxFlexGridSizer *audio_sizer;
wxStaticBoxSizer *audio_bsizer; wxStaticBoxSizer *audio_bsizer;
wxStaticText *audio_decoded_text; wxStaticText *audio_decoded_text;
......
...@@ -1328,6 +1328,7 @@ static int transcode_audio_process( sout_stream_t *p_stream, ...@@ -1328,6 +1328,7 @@ static int transcode_audio_process( sout_stream_t *p_stream,
while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder, while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder,
&in )) ) &in )) )
{ {
stats_UpdateInteger( p_stream->p_parent->p_parent, "decoded_audio", 1 );
if( p_sys->b_master_sync ) if( p_sys->b_master_sync )
{ {
mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1; mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
...@@ -1730,6 +1731,7 @@ static int transcode_video_process( sout_stream_t *p_stream, ...@@ -1730,6 +1731,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) ) while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) )
{ {
subpicture_t *p_subpic = 0; subpicture_t *p_subpic = 0;
stats_UpdateInteger( p_stream->p_parent->p_parent, "decoded_video", 1 );
if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up ) if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up )
{ {
......
...@@ -183,6 +183,7 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id, char *psz_name, vlc_valu ...@@ -183,6 +183,7 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id, char *psz_name, vlc_valu
{ {
vlc_mutex_unlock( &p_handler->object_lock ); vlc_mutex_unlock( &p_handler->object_lock );
vlc_object_release( p_handler ); vlc_object_release( p_handler );
val->i_int = val->f_float = 0.0;
return VLC_ENOOBJ; return VLC_ENOOBJ;
} }
...@@ -255,7 +256,7 @@ counter_t *__stats_CounterGet( vlc_object_t *p_this, int i_object_id, ...@@ -255,7 +256,7 @@ counter_t *__stats_CounterGet( vlc_object_t *p_this, int i_object_id,
vlc_mutex_lock( &p_handler->object_lock ); vlc_mutex_lock( &p_handler->object_lock );
/* Look for existing element */ /* Look for existing element */
p_counter = GetCounter( p_handler, p_this->i_object_id, p_counter = GetCounter( p_handler, i_object_id,
psz_name ); psz_name );
vlc_mutex_unlock( &p_handler->object_lock ); vlc_mutex_unlock( &p_handler->object_lock );
vlc_object_release( p_handler ); vlc_object_release( p_handler );
...@@ -290,13 +291,21 @@ void stats_ComputeInputStats( input_thread_t *p_input, ...@@ -290,13 +291,21 @@ void stats_ComputeInputStats( input_thread_t *p_input,
stats_GetInteger( p_input, p_input->i_object_id, "decoded_audio", stats_GetInteger( p_input, p_input->i_object_id, "decoded_audio",
&p_stats->i_decoded_audio ); &p_stats->i_decoded_audio );
/* Sout */
stats_GetInteger( p_input, p_input->i_object_id, "sout_sent_packets",
&p_stats->i_sent_packets );
stats_GetInteger( p_input, p_input->i_object_id, "sout_sent_bytes",
&p_stats->i_sent_bytes );
stats_GetFloat ( p_input, p_input->i_object_id, "sout_send_bitrate",
&p_stats->f_send_bitrate );
/* Aout - We store in p_input because aout is shared */ /* Aout - We store in p_input because aout is shared */
stats_GetInteger( p_input, p_input->i_object_id, "played_abuffers", stats_GetInteger( p_input, p_input->i_object_id, "played_abuffers",
&p_stats->i_played_abuffers ); &p_stats->i_played_abuffers );
stats_GetInteger( p_input, p_input->i_object_id, "lost_abuffers", stats_GetInteger( p_input, p_input->i_object_id, "lost_abuffers",
&p_stats->i_lost_abuffers ); &p_stats->i_lost_abuffers );
/* Vouts */ /* Vouts - FIXME: Store all in input */
p_list = vlc_list_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD ); p_list = vlc_list_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_list ) if( p_list )
{ {
...@@ -327,7 +336,9 @@ void stats_ReinitInputStats( input_stats_t *p_stats ) ...@@ -327,7 +336,9 @@ void stats_ReinitInputStats( input_stats_t *p_stats )
p_stats->f_demux_bitrate = p_stats->f_average_demux_bitrate = p_stats->f_demux_bitrate = p_stats->f_average_demux_bitrate =
p_stats->i_displayed_pictures = p_stats->i_lost_pictures = p_stats->i_displayed_pictures = p_stats->i_lost_pictures =
p_stats->i_played_abuffers = p_stats->i_lost_abuffers = p_stats->i_played_abuffers = p_stats->i_lost_abuffers =
p_stats->i_decoded_video = p_stats->i_decoded_audio = 0; p_stats->i_decoded_video = p_stats->i_decoded_audio =
p_stats->i_sent_bytes = p_stats->i_sent_packets = p_stats->f_send_bitrate
= 0;
} }
void stats_DumpInputStats( input_stats_t *p_stats ) void stats_DumpInputStats( input_stats_t *p_stats )
...@@ -336,13 +347,14 @@ void stats_DumpInputStats( input_stats_t *p_stats ) ...@@ -336,13 +347,14 @@ void stats_DumpInputStats( input_stats_t *p_stats )
/* f_bitrate is in bytes / microsecond /* f_bitrate is in bytes / microsecond
* *1000 => bytes / millisecond => kbytes / seconds */ * *1000 => bytes / millisecond => kbytes / seconds */
fprintf( stderr, "Input : %i (%i bytes) - %f kB/s - Demux : %i (%i bytes) - %f kB/s\n" fprintf( stderr, "Input : %i (%i bytes) - %f kB/s - Demux : %i (%i bytes) - %f kB/s\n"
" - Vout : %i/%i - Aout : %i/%i\n", " - Vout : %i/%i - Aout : %i/%i - Vout : %f\n",
p_stats->i_read_packets, p_stats->i_read_bytes, p_stats->i_read_packets, p_stats->i_read_bytes,
p_stats->f_input_bitrate * 1000, p_stats->f_input_bitrate * 1000,
p_stats->i_demux_read_packets, p_stats->i_demux_read_bytes, p_stats->i_demux_read_packets, p_stats->i_demux_read_bytes,
p_stats->f_demux_bitrate * 1000, p_stats->f_demux_bitrate * 1000,
p_stats->i_displayed_pictures, p_stats->i_lost_pictures, p_stats->i_displayed_pictures, p_stats->i_lost_pictures,
p_stats->i_played_abuffers, p_stats->i_lost_abuffers ); p_stats->i_played_abuffers, p_stats->i_lost_abuffers,
p_stats->f_send_bitrate );
vlc_mutex_unlock( &p_stats->lock ); vlc_mutex_unlock( &p_stats->lock );
} }
......
...@@ -71,6 +71,7 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest ) ...@@ -71,6 +71,7 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
{ {
sout_instance_t *p_sout; sout_instance_t *p_sout;
vlc_value_t keep; vlc_value_t keep;
counter_t *p_counter;
if( var_Get( p_parent, "sout-keep", &keep ) < 0 ) if( var_Get( p_parent, "sout-keep", &keep ) < 0 )
{ {
...@@ -140,6 +141,16 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest ) ...@@ -140,6 +141,16 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
/* attach it for inherit */ /* attach it for inherit */
vlc_object_attach( p_sout, p_parent ); vlc_object_attach( p_sout, p_parent );
/* Create statistics */
stats_Create( p_parent, "sout_sent_packets",
VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_parent, "sout_sent_bytes", VLC_VAR_INTEGER, STATS_COUNTER );
stats_Create( p_parent, "sout_send_bitrate",
VLC_VAR_FLOAT, STATS_DERIVATIVE );
p_counter = stats_CounterGet( p_parent, p_parent->i_object_id,
"sout_send_bitrate" );
if( p_counter) p_counter->update_interval = 1000000;
p_sout->p_stream = sout_StreamNew( p_sout, p_sout->psz_chain ); p_sout->p_stream = sout_StreamNew( p_sout, p_sout->psz_chain );
if( p_sout->p_stream == NULL ) if( p_sout->p_stream == NULL )
...@@ -354,6 +365,17 @@ int sout_AccessOutRead( sout_access_out_t *p_access, block_t *p_buffer ) ...@@ -354,6 +365,17 @@ 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 sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
{ {
int i_total;
/* Access_out -> sout_instance -> input_thread_t */
stats_UpdateInteger( p_access->p_parent->p_parent,
"sout_sent_packets", 1 );
stats_UpdateInteger( p_access->p_parent->p_parent,
"sout_sent_bytes", p_buffer->i_buffer );
stats_GetInteger( p_access->p_parent->p_parent,
p_access->p_parent->p_parent->i_object_id,
"sout_sent_bytes", &i_total );
stats_UpdateFloat( p_access->p_parent->p_parent, "sout_send_bitrate",
(float)i_total );
return p_access->pf_write( p_access, p_buffer ); return p_access->pf_write( p_access, p_buffer );
} }
......
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