[vlc-devel] commit: stats: Add stream quality counters to Qt4 stastics by counting corrupted blocks and discontinuities found . (Jean-Paul Saman )
git version control
git at videolan.org
Mon Mar 9 14:14:19 CET 2009
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Mon Mar 9 13:46:09 2009 +0100| [682db2c855a083d981af45dda6f3c333b5fd5c3c] | committer: Jean-Paul Saman
stats: Add stream quality counters to Qt4 stastics by counting corrupted blocks and discontinuities found.
Note the quality counters are mere indications and not exact reporting of how much blocks/discontinuity really occured. It will only tell you how often it is noticed.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=682db2c855a083d981af45dda6f3c333b5fd5c3c
---
include/vlc_input_item.h | 2 ++
include/vlc_messages.h | 2 ++
modules/gui/qt4/components/info_panels.cpp | 6 ++++++
modules/gui/qt4/components/info_panels.hpp | 2 ++
src/input/es_out.c | 13 +++++++++++++
src/input/input.c | 2 ++
src/input/input_internal.h | 2 ++
src/misc/stats.c | 5 +++++
8 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 1abdc3b..4ef4e7c 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -228,6 +228,8 @@ struct input_stats_t
int i_demux_read_bytes;
float f_demux_bitrate;
float f_average_demux_bitrate;
+ int i_demux_corrupted;
+ int i_demux_discontinuity;
/* Decoders */
int i_decoded_audio;
diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index 19cf3c9..a9f03d7 100644
--- a/include/vlc_messages.h
+++ b/include/vlc_messages.h
@@ -171,6 +171,8 @@ enum
STATS_READ_PACKETS,
STATS_DEMUX_READ,
STATS_DEMUX_BITRATE,
+ STATS_DEMUX_CORRUPTED,
+ STATS_DEMUX_DISCONTINUITY,
STATS_PLAYED_ABUFFERS,
STATS_LOST_ABUFFERS,
STATS_DECODED_AUDIO,
diff --git a/modules/gui/qt4/components/info_panels.cpp b/modules/gui/qt4/components/info_panels.cpp
index 755b197..4b82ed4 100644
--- a/modules/gui/qt4/components/info_panels.cpp
+++ b/modules/gui/qt4/components/info_panels.cpp
@@ -526,6 +526,10 @@ InputStatsPanel::InputStatsPanel( QWidget *parent,
CREATE_AND_ADD_TO_CAT( demuxed_stat, qtr("Demuxed"), "0", input, "kB") ;
CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, qtr("Stream bitrate"),
"0", input, "kb/s" );
+ CREATE_AND_ADD_TO_CAT( corrupted_stat, qtr("Corrupted"),
+ "0", input, "" );
+ CREATE_AND_ADD_TO_CAT( discontinuity_stat, qtr("Discontinuities"),
+ "0", input, "" );
CREATE_AND_ADD_TO_CAT( vdecoded_stat, qtr("Decoded blocks"),
"0", video, "" );
@@ -576,6 +580,8 @@ void InputStatsPanel::update( input_item_t *p_item )
(float)(p_item->p_stats->i_demux_read_bytes)/1000 );
UPDATE( stream_bitrate_stat, "%6.0f",
(float)(p_item->p_stats->f_demux_bitrate * 8000 ));
+ UPDATE( corrupted_stat, "%5i", p_item->p_stats->i_demux_corrupted );
+ UPDATE( discontinuity_stat, "%5i", p_item->p_stats->i_demux_discontinuity );
/* Video */
UPDATE( vdecoded_stat, "%5i", p_item->p_stats->i_decoded_video );
diff --git a/modules/gui/qt4/components/info_panels.hpp b/modules/gui/qt4/components/info_panels.hpp
index d1e5084..5f3be52 100644
--- a/modules/gui/qt4/components/info_panels.hpp
+++ b/modules/gui/qt4/components/info_panels.hpp
@@ -120,6 +120,8 @@ private:
QTreeWidgetItem *input_bitrate_stat;
QTreeWidgetItem *demuxed_stat;
QTreeWidgetItem *stream_bitrate_stat;
+ QTreeWidgetItem *corrupted_stat;
+ QTreeWidgetItem *discontinuity_stat;
QTreeWidgetItem *video;
QTreeWidgetItem *vdecoded_stat;
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1481ad1..9954443 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1863,6 +1863,19 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
p_block->i_buffer, &i_total );
stats_UpdateFloat( p_input , p_input->p->counters.p_demux_bitrate,
(float)i_total, NULL );
+
+ /* Update number of corrupted data packats */
+ if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ {
+ stats_UpdateInteger( p_input, p_input->p->counters.p_demux_corrupted,
+ 1, NULL );
+ }
+ /* Update number of discontinuities */
+ if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ {
+ stats_UpdateInteger( p_input, p_input->p->counters.p_demux_discontinuity,
+ 1, NULL );
+ }
vlc_mutex_unlock( &p_input->p->counters.counters_lock );
}
diff --git a/src/input/input.c b/src/input/input.c
index 0735573..bdf91af 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -801,6 +801,8 @@ static void InitStatistics( input_thread_t * p_input )
INIT_COUNTER( demux_read, INTEGER, COUNTER );
INIT_COUNTER( input_bitrate, FLOAT, DERIVATIVE );
INIT_COUNTER( demux_bitrate, FLOAT, DERIVATIVE );
+ INIT_COUNTER( demux_corrupted, INTEGER, COUNTER );
+ INIT_COUNTER( demux_discontinuity, INTEGER, COUNTER );
INIT_COUNTER( played_abuffers, INTEGER, COUNTER );
INIT_COUNTER( lost_abuffers, INTEGER, COUNTER );
INIT_COUNTER( displayed_pictures, INTEGER, COUNTER );
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index e30e777..ee3dbd2 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -139,6 +139,8 @@ struct input_thread_private_t
counter_t *p_input_bitrate;
counter_t *p_demux_read;
counter_t *p_demux_bitrate;
+ counter_t *p_demux_corrupted;
+ counter_t *p_demux_discontinuity;
counter_t *p_decoded_audio;
counter_t *p_decoded_video;
counter_t *p_decoded_sub;
diff --git a/src/misc/stats.c b/src/misc/stats.c
index da4e10d..048b61b 100644
--- a/src/misc/stats.c
+++ b/src/misc/stats.c
@@ -171,6 +171,10 @@ void stats_ComputeInputStats( input_thread_t *p_input, input_stats_t *p_stats )
&p_stats->i_demux_read_bytes );
stats_GetFloat( p_input, p_input->p->counters.p_demux_bitrate,
&p_stats->f_demux_bitrate );
+ stats_GetInteger( p_input, p_input->p->counters.p_demux_corrupted,
+ &p_stats->i_demux_corrupted );
+ stats_GetInteger( p_input, p_input->p->counters.p_demux_discontinuity,
+ &p_stats->i_demux_discontinuity );
/* Decoders */
stats_GetInteger( p_input, p_input->p->counters.p_decoded_video,
@@ -212,6 +216,7 @@ void stats_ReinitInputStats( input_stats_t *p_stats )
p_stats->f_input_bitrate = p_stats->f_average_input_bitrate =
p_stats->i_demux_read_packets = p_stats->i_demux_read_bytes =
p_stats->f_demux_bitrate = p_stats->f_average_demux_bitrate =
+ p_stats->i_demux_corrupted = p_stats->i_demux_discontinuity =
p_stats->i_displayed_pictures = p_stats->i_lost_pictures =
p_stats->i_played_abuffers = p_stats->i_lost_abuffers =
p_stats->i_decoded_video = p_stats->i_decoded_audio =
More information about the vlc-devel
mailing list