[mythtv] Network Recorder binding to specific eth device?

Robert Johnston anaerin at gmail.com
Mon Oct 12 07:48:08 UTC 2009

It's been a long time since this was looked at, and I see it's not
actually moved anywhere. Here's the problem, and what I can see, as a
non-coder, as the potential solution.

As it stands, when the IPTV recorder sets up to capture and record, it
requests to join the multicast group on all interfaces.

For a very basic setup, this works fine. However, there is a problem.
Some (Most) IPTV providers only allow each "Box" to capture a limited
number of streams (2 per interface).

This is a problem. Adding more cards (real or virtual) to the backend
server won't allow for more channels to be recorded, as (as far as the
server sees it) both "boxes" have requested the same channels, and
filled their allotment.

Using the existing controls provided by groupsockhelper.cpp won't help
either, as they only allow you to specify sending and receiving
addresses by IP - in Multicast neither the receiving, nor sending
addresses are your own. Thus, enabling these options will stop all
multicast traffic being received.

Thus far, there is only one way to get around this, and this is to set
up a slave backend with the next (two) network cards in. This is a
huge waste of resources.

The way it should be done, is using the socket options. Specifically:

char *optval2;
// bind a socket to a device name (might not work on all systems):
optval2 = "eth1"; // 4 bytes long, so 4, below:
setsockopt(socket, SOL_SOCKET, SO_BINDTODEVICE, optval2, 4);

Obviously, in this case, the hardcoded "eth1" needs to be exposed to
the user, somewhere in MythTV Setup (There is the space for it),
stored in the DB, and used at initialisation. This needs to be added
inside libmythlivemedia/groupsock/GroupsockHelper.cpp at around lines
60 and 139. This also means the constructor will need to be changed,
which needs to be taken into account in all places this library is

Anyone care to implement this (reasonably quick and simple) change,
and make us IPTV'ers a lot happier as a result?

Robert "Anaerin" Johnston
Sent from Regina, Saskatchewan, Canada

More information about the mythtv-dev mailing list