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

Origin commit data
------------------
Commit: cfb4a77485
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-06-21 (Thu, 21 Jun 2012)
This commit is contained in:
[CST] Focus
2012-06-21 14:35:47 +04:00
parent 6fbc94fa2b
commit 14a913e98b

View File

@@ -208,8 +208,6 @@ void streamts_main_thread(void * /*data*/)
if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) {
printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents);
if (pfd[i].fd == listenfd) {
if(connfd >= 0)
close(connfd);
connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen);
printf("new connection, fd %d\n", connfd);
if(connfd < 0) {
@@ -315,7 +313,14 @@ void * streamts_live_thread(void *data)
if(demuxfd_count == 0) {
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);