{
msg_Warn( p_aout, "received buffer in the future (%"PRId64")",
p_aout_buf->start_date - mdate() );
- i_lost++;
}
+ i_lost++;
aout_DecDeleteBuffer( p_aout, p_aout_input, p_aout_buf );
}
if( i_decoded > 0 || i_lost > 0 || i_played > 0 )
{
vlc_mutex_lock( &p_input->p->counters.counters_lock);
+
stats_UpdateInteger( p_dec, p_input->p->counters.p_lost_abuffers,
i_lost, NULL );
stats_UpdateInteger( p_dec, p_input->p->counters.p_played_abuffers,
i_played, NULL );
stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_audio,
i_decoded, NULL );
+
vlc_mutex_unlock( &p_input->p->counters.counters_lock);
}
}
decoder_owner_sys_t *p_owner = p_dec->p_owner;
input_thread_t *p_input = p_owner->p_input;
picture_t *p_pic;
+ int i_lost = 0;
+ int i_decoded = 0;
+ int i_displayed = 0;
while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) )
{
break;
}
- vlc_mutex_lock( &p_input->p->counters.counters_lock );
- stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_video, 1, NULL );
- vlc_mutex_unlock( &p_input->p->counters.counters_lock );
+ i_decoded++;
if( p_pic->date < p_owner->i_preroll_end )
{
DecoderVoutBufferFixTs( p_pic, p_owner->p_clock, p_input->i_pts_delay );
- vout_DatePicture( p_vout, p_pic, p_pic->date );
+ /* Video is never delayed so simple */
+ const mtime_t i_max_date = mdate() + p_input->i_pts_delay + VOUT_BOGUS_DELAY;
- /* Re-enable it but do it right this time */
- //DecoderOptimizePtsDelay( p_dec );
+ if( p_pic->date > 0 && p_pic->date < i_max_date )
+ {
+ vout_DatePicture( p_vout, p_pic, p_pic->date );
- vout_DisplayPicture( p_vout, p_pic );
+ /* Re-enable it but do it right this time */
+ //DecoderOptimizePtsDelay( p_dec );
+ vout_DisplayPicture( p_vout, p_pic );
+ }
+ else
+ {
+ if( p_pic->date <= 0 )
+ {
+ msg_Warn( p_vout, "non-dated video buffer received" );
+ }
+ else
+ {
+ msg_Warn( p_vout, "early picture skipped (%"PRId64")",
+ p_pic->date - mdate() );
+ }
+ i_lost++;
+ VoutDisplayedPicture( p_vout, p_pic );
+ }
+ int i_tmp_display;
+ int i_tmp_lost;
+ vout_GetResetStatistic( p_vout, &i_tmp_display, &i_tmp_lost );
+
+ i_displayed += i_tmp_display;
+ i_lost += i_tmp_lost;
+ }
+ if( i_decoded > 0 || i_lost > 0 || i_displayed > 0 )
+ {
+ vlc_mutex_lock( &p_input->p->counters.counters_lock );
+
+ stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_video,
+ i_decoded, NULL );
+ stats_UpdateInteger( p_dec, p_input->p->counters.p_lost_pictures,
+ i_lost , NULL);
+
+ stats_UpdateInteger( p_dec, p_input->p->counters.p_displayed_pictures,
+ i_displayed, NULL);
+
+ vlc_mutex_unlock( &p_input->p->counters.counters_lock );
}
}
/** FIXME This is quite ugly but needed while we don't have counters
* helpers */
-#include "input/input_internal.h"
+//#include "input/input_internal.h"
+#include <libvlc.h>
+#include <vlc_input.h>
#include "modules/modules.h"
#include "vout_pictures.h"
#include "vout_internal.h"
vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
{
vout_thread_t * p_vout; /* thread descriptor */
- input_thread_t * p_input_thread;
int i_index; /* loop variable */
vlc_value_t val, text;
p_vout->i_alignment = 0;
p_vout->p->render_time = 10;
p_vout->p->c_fps_samples = 0;
+ p_vout->p->i_picture_lost = 0;
+ p_vout->p->i_picture_displayed = 0;
p_vout->p->b_filter_change = 0;
p_vout->p->b_paused = false;
p_vout->p->i_pause_date = 0;
var_Change( p_vout, "vout-filter", VLC_VAR_SETTEXT, &text, NULL );
var_AddCallback( p_vout, "vout-filter", FilterCallback, NULL );
- /* Calculate delay created by internal caching */
- p_input_thread = (input_thread_t *)vlc_object_find( p_vout,
- VLC_OBJECT_INPUT, FIND_ANYWHERE );
- if( p_input_thread )
- {
- p_vout->p->i_pts_delay = p_input_thread->i_pts_delay;
- vlc_object_release( p_input_thread );
- }
- else
- {
- p_vout->p->i_pts_delay = DEFAULT_PTS_DELAY;
- }
-
if( vlc_thread_create( p_vout, "video output", RunThread,
VLC_THREAD_PRIORITY_OUTPUT, true ) )
{
vlc_object_unlock( p_vout );
}
+void vout_GetResetStatistic( vout_thread_t *p_vout, int *pi_displayed, int *pi_lost )
+{
+ vlc_object_lock( p_vout );
+
+ *pi_displayed = p_vout->p->i_picture_displayed;
+ *pi_lost = p_vout->p->i_picture_lost;
+
+ p_vout->p->i_picture_displayed = 0;
+ p_vout->p->i_picture_lost = 0;
+
+ vlc_object_unlock( p_vout );
+}
/*****************************************************************************
* InitThread: initialize video output thread
bool b_drop_late;
- int i_displayed = 0, i_lost = 0;
int canc = vlc_savecancel ();
/*
picture_t *p_filtered_picture;
mtime_t display_date = 0;
picture_t *p_directbuffer;
- input_thread_t *p_input;
int i_index;
#if 0
}
#endif
- /* Update statistics */
- p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
- if( p_input )
- {
- vlc_mutex_lock( &p_input->p->counters.counters_lock );
- stats_UpdateInteger( p_vout, p_input->p->counters.p_lost_pictures,
- i_lost , NULL);
- stats_UpdateInteger( p_vout,
- p_input->p->counters.p_displayed_pictures,
- i_displayed , NULL);
- i_displayed = i_lost = 0;
- vlc_mutex_unlock( &p_input->p->counters.counters_lock );
- vlc_object_release( p_input );
- }
-
/*
* Find the picture to display (the one with the earliest date).
* This operation does not need lock, since only READY_PICTUREs
/* Picture is late: it will be destroyed and the thread
* will directly choose the next picture */
DropPicture( p_vout, p_picture );
- i_lost++;
+ p_vout->p->i_picture_lost++;
msg_Warn( p_vout, "late picture skipped (%"PRId64")",
current_date - display_date );
continue;
}
- if( display_date >
- current_date + p_vout->p->i_pts_delay + VOUT_BOGUS_DELAY )
- {
- /* Picture is waaay too early: it will be destroyed */
- DropPicture( p_vout, p_picture );
- i_lost++;
- msg_Warn( p_vout, "vout warning: early picture skipped "
- "(%"PRId64")", display_date - current_date
- - p_vout->p->i_pts_delay );
- continue;
- }
-
if( display_date > current_date + VOUT_DISPLAY_DELAY )
{
/* A picture is ready to be rendered, but its rendering date
/*
* Perform rendering
*/
- i_displayed++;
+ p_vout->p->i_picture_displayed++;
p_directbuffer = vout_RenderPicture( p_vout, p_filtered_picture,
p_subpic, p_vout->p->b_paused );