Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into feature/dvb-rewrite
Conflicts:
	src/input/mpegts/tsdemux.c
  • Loading branch information
adamsutton committed Nov 15, 2013
2 parents afc48f9 + 098b7de commit 288adcc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 21 deletions.
7 changes: 5 additions & 2 deletions src/input/mpegts/tsdemux.c
Expand Up @@ -73,6 +73,9 @@ ts_recv_packet0
if(streaming_pad_probe_type(&t->s_streaming_pad, SMT_MPEGTS))
ts_remux(t, tsb);

if (!st)
return;

error = !!(tsb[1] & 0x80);
pusi = !!(tsb[1] & 0x40);

Expand Down Expand Up @@ -218,7 +221,7 @@ ts_recv_packet1(mpegts_service_t *t, const uint8_t *tsb, int64_t *pcrp)
if (pcr != PTS_UNSET)
ts_process_pcr(t, st, pcr);

if(st == NULL) {
if((st == NULL) && (pid != t->s_pcr_pid)) {
pthread_mutex_unlock(&t->s_stream_mutex);
return 0;
}
Expand All @@ -229,7 +232,7 @@ ts_recv_packet1(mpegts_service_t *t, const uint8_t *tsb, int64_t *pcrp)
avgstat_add(&t->s_rate, 188, dispatch_clock);

if((tsb[3] & 0xc0) ||
(t->s_scrambled_seen && st->es_type != SCT_CA)) {
(t->s_scrambled_seen && st && st->es_type != SCT_CA)) {

/**
* Lock for descrambling, but only if packet was not in error
Expand Down
13 changes: 8 additions & 5 deletions src/plumbing/transcoding.c
Expand Up @@ -188,6 +188,7 @@ transcoder_stream_packet(transcoder_stream_t *ts, th_pkt_t *pkt)

sm = streaming_msg_create_pkt(pkt);
streaming_target_deliver2(ts->ts_target, sm);
pkt_ref_dec(pkt);
}


Expand Down Expand Up @@ -243,6 +244,7 @@ transcoder_stream_subtitle(transcoder_stream_t *ts, th_pkt_t *pkt)

cleanup:
av_free_packet(&packet);
pkt_ref_dec(pkt);
avsubtitle_free(&sub);
}

Expand Down Expand Up @@ -445,6 +447,7 @@ transcoder_stream_audio(transcoder_stream_t *ts, th_pkt_t *pkt)

cleanup:
av_free_packet(&packet);
pkt_ref_dec(pkt);
}


Expand Down Expand Up @@ -724,6 +727,7 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt)

cleanup:
av_free_packet(&packet);
pkt_ref_dec(pkt);

if(buf)
av_free(buf);
Expand Down Expand Up @@ -752,8 +756,10 @@ transcoder_packet(transcoder_t *t, th_pkt_t *pkt)
continue;

ts->ts_handle_pkt(ts, pkt);
break;
return;
}

pkt_ref_dec(pkt);
}


Expand Down Expand Up @@ -1247,15 +1253,12 @@ transcoder_input(void *opaque, streaming_message_t *sm)
{
transcoder_t *t;
streaming_start_t *ss;
th_pkt_t *pkt;

t = opaque;

switch (sm->sm_type) {
case SMT_PACKET:
pkt = sm->sm_data;
transcoder_packet(t, pkt);
pkt_ref_dec(pkt);
transcoder_packet(t, sm->sm_data);
break;

case SMT_START:
Expand Down
44 changes: 31 additions & 13 deletions src/tvhpoll.c
Expand Up @@ -76,7 +76,7 @@ tvhpoll_create ( size_t n )
return NULL;
}
#elif ENABLE_KQUEUE
if ((fd = kqueue()) < 0) {
if ((fd = kqueue()) == -1) {
tvhlog(LOG_ERR, "tvhpoll", "failed to create kqueue [%s]",
strerror(errno));
return NULL;
Expand Down Expand Up @@ -118,16 +118,31 @@ int tvhpoll_add
return 0;
#elif ENABLE_KQUEUE
int i;
uint32_t fflags;
int rc;
tvhpoll_alloc(tp, num);
for (i = 0; i < num; i++) {
fflags = 0;
if (evs[i].events & TVHPOLL_OUT) fflags |= EVFILT_WRITE;
if (evs[i].events & TVHPOLL_IN) fflags |= EVFILT_READ;
EV_SET(tp->ev+i, evs[i].fd, fflags, EV_ADD, 0, 0, (void*)evs[i].data.u64);
if (evs[i].events & TVHPOLL_OUT){
EV_SET(tp->ev+i, evs[i].fd, EVFILT_WRITE, EV_ADD, 0, 0, (intptr_t*)evs[i].data.u64);
rc = kevent(tp->fd, tp->ev+i, 1, NULL, 0, NULL);
if (rc == -1) {
tvhlog(LOG_ERR, "tvhpoll", "failed to add kqueue WRITE filter [%d|%d]",
evs[i].fd, rc);
return -1;
}
}
if (evs[i].events & TVHPOLL_IN){
EV_SET(tp->ev+i, evs[i].fd, EVFILT_READ, EV_ADD, 0, 0, (intptr_t*)evs[i].data.u64);
rc = kevent(tp->fd, tp->ev+i, 1, NULL, 0, NULL);
if (rc == -1) {
tvhlog(LOG_ERR, "tvhpoll", "failed to add kqueue READ filter [%d|%d]",
evs[i].fd, rc);
return -1;
}
}
}
return kevent(tp->fd, tp->ev, num, NULL, 0, NULL);
return 0;
#else
return -1;
#endif
}

Expand All @@ -141,9 +156,11 @@ int tvhpoll_rem
epoll_ctl(tp->fd, EPOLL_CTL_DEL, evs[i].fd, NULL);
#elif ENABLE_KQUEUE
int i;
for (i = 0; i < num; i++)
for (i = 0; i < num; i++) {
EV_SET(tp->ev+i, evs[i].fd, 0, EV_DELETE, 0, 0, NULL);
kevent(tp->fd, tp->ev, num, NULL, 0, NULL);
if (kevent(tp->fd, tp->ev+i, 1, NULL, 0, NULL) == -1)
return -1;
}
#else
#endif
return 0;
Expand All @@ -167,7 +184,7 @@ int tvhpoll_wait
}
#elif ENABLE_KQUEUE
struct timespec tm, *to = NULL;
if (ms) {
if (ms > 0) {
tm.tv_sec = ms / 1000;
tm.tv_nsec = (ms % 1000) * 1000000LL;
to = &tm;
Expand All @@ -176,9 +193,10 @@ int tvhpoll_wait
for (i = 0; i < nfds; i++) {
evs[i].fd = tp->ev[i].ident;
evs[i].events = 0;
evs[i].data.u64 = (uint64_t)tp->ev[i].udata;
if (tp->ev[i].fflags & EVFILT_WRITE) evs[i].events |= TVHPOLL_OUT;
if (tp->ev[i].fflags & EVFILT_READ) evs[i].events |= TVHPOLL_IN;
evs[i].data.u64 = (intptr_t)tp->ev[i].udata;
if (tp->ev[i].filter == EVFILT_WRITE) evs[i].events |= TVHPOLL_OUT;
if (tp->ev[i].filter == EVFILT_READ) evs[i].events |= TVHPOLL_IN;
if (tp->ev[i].flags & EV_ERROR) evs[i].events |= TVHPOLL_ERR;
if (tp->ev[i].flags & EV_EOF) evs[i].events |= TVHPOLL_HUP;
}
#else
Expand Down
2 changes: 1 addition & 1 deletion support/apt-update
Expand Up @@ -18,7 +18,7 @@ DIR=$(cd $(dirname "$0"); pwd)

# Configuration
TVH_ROOT=$(cd "$(dirname "$0")"/..; pwd)
[ -z "$TVH_DIST" ] && TVH_DIST="wheezy lucid oneiric precise quantal raring"
[ -z "$TVH_DIST" ] && TVH_DIST="wheezy lucid precise quantal raring saucy"
[ -z "$TVH_ARCH" ] && TVH_ARCH="i386 amd64"

# Options
Expand Down

0 comments on commit 288adcc

Please sign in to comment.