driver/streamts.cpp: fix streaming to new connection; send current channel pids, if no pids in url

This commit is contained in:
[CST] Focus
2012-06-21 14:35:47 +04:00
parent 272e43e203
commit cfb4a77485

View File

@@ -208,8 +208,6 @@ void streamts_main_thread(void * /*data*/)
if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) { if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) {
printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents); printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents);
if (pfd[i].fd == listenfd) { if (pfd[i].fd == listenfd) {
if(connfd >= 0)
close(connfd);
connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen); connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen);
printf("new connection, fd %d\n", connfd); printf("new connection, fd %d\n", connfd);
if(connfd < 0) { if(connfd < 0) {
@@ -315,7 +313,14 @@ void * streamts_live_thread(void *data)
if(demuxfd_count == 0) { if(demuxfd_count == 0) {
printf("No pids!\n"); printf("No pids!\n");
return 0; CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
if(!channel)
return 0;
pids[demuxfd_count++] = 0;
pids[demuxfd_count++] = channel->getPmtPid();
pids[demuxfd_count++] = channel->getVideoPid();
for (int i = 0; i < channel->getAudioChannelCount(); i++)
pids[demuxfd_count++] = channel->getAudioChannel(i)->pid;
} }
buf = (unsigned char *) malloc(IN_SIZE); buf = (unsigned char *) malloc(IN_SIZE);