Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP client: add 'Skip TS packets (0-200)' option, fixes #3137
  • Loading branch information
perexg committed Oct 9, 2015
1 parent 1ffad11 commit e79ea98
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
7 changes: 7 additions & 0 deletions src/input/mpegts/satip/satip.c
Expand Up @@ -284,6 +284,13 @@ const idclass_t satip_device_class =
.opts = PO_ADVANCED,
.off = offsetof(satip_device_t, sd_bindaddr),
},
{
.type = PT_INT,
.id = "skip_ts",
.name = N_("Skip TS packets (0-200)"),
.opts = PO_ADVANCED,
.off = offsetof(satip_device_t, sd_skip_ts),
},
{
.type = PT_BOOL,
.id = "disableworkarounds",
Expand Down
39 changes: 32 additions & 7 deletions src/input/mpegts/satip/satip_frontend.c
Expand Up @@ -971,7 +971,7 @@ satip_frontend_close_rtsp
static int
satip_frontend_rtp_data_received( http_client_t *hc, void *buf, size_t len )
{
int c, pos;
int c, pos, r;
uint32_t nseq, unc;
uint8_t *b = buf, *p;
satip_frontend_t *lfe = hc->hc_aux;
Expand All @@ -998,7 +998,8 @@ satip_frontend_rtp_data_received( http_client_t *hc, void *buf, size_t len )
return 0;
pos += (((p[pos+2] << 8) | p[pos+3]) + 1) * 4;
}
if (c <= pos || ((c - pos) % 188) != 0)
r = c - pos;
if (c <= pos || (r % 188) != 0)
return 0;
/* Use uncorrectable value to notify RTP delivery issues */
nseq = (p[2] << 8) | p[3];
Expand All @@ -1012,8 +1013,19 @@ satip_frontend_rtp_data_received( http_client_t *hc, void *buf, size_t len )
lfe->sf_seq = nseq;

/* Process */
tsdebug_write((mpegts_mux_t *)lfe->sf_curmux, p + pos, c - pos);
sbuf_append(&lfe->sf_sbuf, p + pos, c - pos);
if (lfe->sf_skip_ts > 0) {
if (lfe->sf_skip_ts < r) {
pos += lfe->sf_skip_ts;
lfe->sf_skip_ts = 0;
goto wrdata;
} else {
lfe->sf_skip_ts -= r;
}
} else {
wrdata:
tsdebug_write((mpegts_mux_t *)lfe->sf_curmux, p + pos, c - pos);
sbuf_append(&lfe->sf_sbuf, p + pos, c - pos);
}

if (lfe->sf_sbuf.sb_ptr > 64 * 1024 ||
lfe->sf_last_data_tstamp != dispatch_clock) {
Expand Down Expand Up @@ -1344,6 +1356,7 @@ satip_frontend_input_thread ( void *aux )

udp_multirecv_init(&um, RTP_PKTS, RTP_PKT_SIZE);
sbuf_init_fixed(sb, RTP_PKTS * RTP_PKT_SIZE);
lfe->sf_skip_ts = MIN(200, MAX(0, lfe->sf_device->sd_skip_ts)) * 188;

while ((reply || running) && !fatal) {

Expand Down Expand Up @@ -1539,7 +1552,8 @@ satip_frontend_input_thread ( void *aux )
continue;
pos += (((p[pos+2] << 8) | p[pos+3]) + 1) * 4;
}
if (c <= pos || ((c - pos) % 188) != 0)
r = c - pos;
if (c <= pos || (r % 188) != 0)
continue;
/* Use uncorrectable value to notify RTP delivery issues */
nseq = (p[2] << 8) | p[3];
Expand All @@ -1551,8 +1565,19 @@ satip_frontend_input_thread ( void *aux )
}
seq = nseq;
/* Process */
tsdebug_write((mpegts_mux_t *)lm, p + pos, c - pos);
sbuf_append(sb, p + pos, c - pos);
if (lfe->sf_skip_ts > 0) {
if (lfe->sf_skip_ts < r) {
pos += lfe->sf_skip_ts;
lfe->sf_skip_ts = 0;
goto wrdata;
} else {
lfe->sf_skip_ts -= r;
}
} else {
wrdata:
tsdebug_write((mpegts_mux_t *)lm, p + pos, c - pos);
sbuf_append(sb, p + pos, c - pos);
}
}
pthread_mutex_lock(&lfe->sf_dvr_lock);
if (lfe->sf_req == lfe->sf_req_thread) {
Expand Down
2 changes: 2 additions & 0 deletions src/input/mpegts/satip/satip_private.h
Expand Up @@ -93,6 +93,7 @@ struct satip_device
int sd_pilot_on;
int sd_no_univ_lnb;
int sd_dbus_allow;
int sd_skip_ts;
int sd_disable_workarounds;
pthread_mutex_t sd_tune_mutex;
};
Expand Down Expand Up @@ -145,6 +146,7 @@ struct satip_frontend
satip_tune_req_t *sf_req;
satip_tune_req_t *sf_req_thread;
sbuf_t sf_sbuf;
int sf_skip_ts;
const char * sf_display_name;
uint32_t sf_seq;
dvb_mux_t *sf_curmux;
Expand Down

0 comments on commit e79ea98

Please sign in to comment.