Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts elementary stream: remove pcr decoder - not used
  • Loading branch information
perexg committed Mar 11, 2015
1 parent 1ef7dae commit 2b6dd0f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
44 changes: 0 additions & 44 deletions src/input/mpegts/tsdemux.c
Expand Up @@ -106,46 +106,6 @@ ts_recv_packet0
}
}

/**
* Recover PCR
*
* st->es_pcr_drift will increase if our (system clock) runs faster
* than the stream PCR
*/
static void
ts_process_pcr(mpegts_service_t *t, elementary_stream_t *st, int64_t pcr)
{
int64_t real, d;

if(st == NULL)
return;

real = getmonoclock();

if(st->es_pcr_real_last != PTS_UNSET) {
d = (real - st->es_pcr_real_last) - (pcr - st->es_pcr_last);

if(d < -90000LL || d > 90000LL) {
st->es_pcr_recovery_fails++;
if(st->es_pcr_recovery_fails > 10) {
st->es_pcr_recovery_fails = 0;
st->es_pcr_real_last = PTS_UNSET;
}
return;
}
st->es_pcr_recovery_fails = 0;
st->es_pcr_drift += d;

if(t->s_pcr_pid == st->es_pid) {
/* This is the registered PCR PID, adjust service PCR drift
via an IIR filter */
t->s_pcr_drift = (t->s_pcr_drift * 255 + st->es_pcr_drift) / 256;
}
}
st->es_pcr_last = pcr;
st->es_pcr_real_last = real;
}

/**
* Process service stream packets, extract PCR and optionally descramble
*/
Expand Down Expand Up @@ -199,10 +159,6 @@ ts_recv_packet1

st = service_stream_find((service_t*)t, pid);

/* Extract PCR */
if (pcr != PTS_UNSET)
ts_process_pcr(t, st, pcr);

if((st == NULL) && (pid != t->s_pcr_pid) && !table) {
pthread_mutex_unlock(&t->s_stream_mutex);
return 0;
Expand Down
5 changes: 0 additions & 5 deletions src/service.c
Expand Up @@ -260,11 +260,6 @@ stream_init(elementary_stream_t *st)
st->es_curpts = PTS_UNSET;
st->es_prevdts = PTS_UNSET;

st->es_pcr_real_last = PTS_UNSET;
st->es_pcr_last = PTS_UNSET;
st->es_pcr_drift = 0;
st->es_pcr_recovery_fails = 0;

st->es_blank = 0;
}

Expand Down
7 changes: 0 additions & 7 deletions src/service.h
Expand Up @@ -64,13 +64,6 @@ typedef struct elementary_stream {

int es_peak_presentation_delay; /* Max seen diff. of DTS and PTS */

/* PCR recovery */

int es_pcr_recovery_fails;
int64_t es_pcr_real_last; /* realtime clock when we saw last PCR */
int64_t es_pcr_last; /* PCR clock when we saw last PCR */
int64_t es_pcr_drift;

/* For service stream packet reassembly */

sbuf_t es_buf;
Expand Down

0 comments on commit 2b6dd0f

Please sign in to comment.