- mtime_t jitter;
-
- jitter = delta_clock - p_pcr->delta_clock;
- /* Compute the maximum jitter */
- if( jitter < 0 )
- {
- if( (p_pcr->max_jitter <= 0 && p_pcr->max_jitter >= jitter) ||
- (p_pcr->max_jitter >= 0 && p_pcr->max_jitter <= -jitter))
- {
- p_pcr->max_jitter = jitter;
- }
- }
- else
- {
- if( (p_pcr->max_jitter <= 0 && -p_pcr->max_jitter <= jitter) ||
- (p_pcr->max_jitter >= 0 && p_pcr->max_jitter <= jitter))
- {
- p_pcr->max_jitter = jitter;
- }
- }
-
- /* Compute the average jitter */
- if( p_pcr->c_average_jitter == PCR_MAX_AVERAGE_COUNTER )
- {
- p_pcr->average_jitter = (jitter + (p_pcr->average_jitter * (PCR_MAX_AVERAGE_COUNTER-1)))
- / PCR_MAX_AVERAGE_COUNTER;
- }
- else
- {
- p_pcr->average_jitter = (jitter + (p_pcr->average_jitter * p_pcr->c_average_jitter))
- / (p_pcr->c_average + 1);
- p_pcr->c_average_jitter++;
- }
-
- printf("delta: % 13Ld, max_jitter: % 9Ld, av. jitter: % 6Ld, PCR %6ld \r",
- p_pcr->delta_clock , p_pcr->max_jitter, p_pcr->average_jitter, p_pcr->c_pcr);
- fflush(stdout);
-
- p_pcr->c_pcr++;