iptv: fix mistakes that stopped UDP/RTP streaming from working.
This commit is contained in:
parent
0e7601b140
commit
cea5d3ffac
2 changed files with 29 additions and 25 deletions
|
@ -223,7 +223,8 @@ iptv_input_stop_mux ( mpegts_input_t *mi, mpegts_mux_instance_t *mmi )
|
|||
pthread_mutex_lock(&iptv_lock);
|
||||
|
||||
/* Stop */
|
||||
im->im_handler->stop(im);
|
||||
if (im->im_handler->stop)
|
||||
im->im_handler->stop(im);
|
||||
|
||||
/* Close file */
|
||||
if (im->mm_iptv_fd > 0) {
|
||||
|
@ -425,6 +426,7 @@ void iptv_init ( void )
|
|||
|
||||
/* Register handlers */
|
||||
iptv_http_init();
|
||||
iptv_udp_init();
|
||||
|
||||
/* Init Input */
|
||||
mpegts_input_create0((mpegts_input_t*)&iptv_input,
|
||||
|
|
|
@ -101,30 +101,30 @@ iptv_udp_start ( iptv_mux_t *im, const url_t *url )
|
|||
goto error;
|
||||
}
|
||||
|
||||
/* Join group */
|
||||
m.imr_multiaddr = sin.sin_addr;
|
||||
m.imr_address.s_addr = 0;
|
||||
#if defined(PLATFORM_LINUX)
|
||||
m.imr_ifindex = ifr.ifr_ifindex;
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
m.imr_ifindex = ifr.ifr_index;
|
||||
#endif
|
||||
#ifdef SOL_IP
|
||||
solip = SOL_IP;
|
||||
#else
|
||||
{
|
||||
struct protoent *pent;
|
||||
pent = getprotobyname("ip");
|
||||
solip = (pent != NULL) ? pent->p_proto : 0;
|
||||
}
|
||||
#endif
|
||||
/* Join group */
|
||||
m.imr_multiaddr = sin.sin_addr;
|
||||
m.imr_address.s_addr = 0;
|
||||
#if defined(PLATFORM_LINUX)
|
||||
m.imr_ifindex = ifr.ifr_ifindex;
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
m.imr_ifindex = ifr.ifr_index;
|
||||
#endif
|
||||
#ifdef SOL_IP
|
||||
solip = SOL_IP;
|
||||
#else
|
||||
{
|
||||
struct protoent *pent;
|
||||
pent = getprotobyname("ip");
|
||||
solip = (pent != NULL) ? pent->p_proto : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (setsockopt(fd, solip, IP_ADD_MEMBERSHIP, &m, sizeof(m))) {
|
||||
inet_ntop(AF_INET, &m.imr_multiaddr, buf, sizeof(buf));
|
||||
tvherror("iptv", "%s - cannot join %s [%s]",
|
||||
name, buf, strerror(errno));
|
||||
goto error;
|
||||
}
|
||||
if (setsockopt(fd, solip, IP_ADD_MEMBERSHIP, &m, sizeof(m))) {
|
||||
inet_ntop(AF_INET, &m.imr_multiaddr, buf, sizeof(buf));
|
||||
tvherror("iptv", "%s - cannot join %s [%s]",
|
||||
name, buf, strerror(errno));
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Bind to IPv6 group */
|
||||
} else {
|
||||
|
@ -171,7 +171,9 @@ iptv_udp_start ( iptv_mux_t *im, const url_t *url )
|
|||
name, strerror(errno));
|
||||
|
||||
/* Done */
|
||||
return fd;
|
||||
im->mm_iptv_fd = fd;
|
||||
iptv_input_mux_started(im);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
close(fd);
|
||||
|
|
Loading…
Add table
Reference in a new issue