[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mythtv-dev
Subject:    Re: [mythtv] devel/rtp: multiple IPTV streams, same port-no
From:       Kevin Kuphal <kkuphal () gmail ! com>
Date:       2012-04-30 15:13:05
Message-ID: CAFySsNq9VGc3w+ey=ttfmnSoKg51E4CLj0KOQJGSAZtNPh-NYA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sun, Apr 29, 2012 at 6:46 AM, Niels Ole Kirkeby <nok@kirkeby.nu> wrote:

>
>
> 2012/4/28 Niels Ole Kirkeby <nok@kirkeby.nu>
>
>> Hi
>>
>> I was trying to figure out why devel/rtp didn't work for me and found a
>> major (if you're struck by it) flaw in the multicast handling in MythTV.
>> The problem is that my provider delivers streams like
>> udp://222.111.222.xx:2000. That is for all streams the port-no is the same.
>> In Linux, basically only the port-no differentiates the various
>> udp-streams. Thus I noticed a strange phenomena in MythTV: two iptv-tuners
>> recording two different streams but all data goes to the first stream !
>>
>> I made a small test-program: Open two sockets, join two different
>> multicast streams (udp://222.111.222.123:2000 and udp://
>> 222.111.222.124:2000). I noticed the bind() for the second socket
>> failed. When I read from the sockets, only the first socket has any data
>> but the data was a merge from both streams ! After some digging I found out
>> that apparently you can only have one common socket for all streams and
>> should use sockopt IP_PKTINFO to find the multicast group the data is for.
>>
>> I'm not quite into the class-relations in MythTV yet but are trying to
>> figure out how to handle this. Could anybody responsible for the devel/rtp
>> branch please comment on this ? Whether this is "just" a patch or a major
>> rewrite ?
>>
>> What's strikes me is that appearently I only had minor problems whether
>> the "old" IPTV code and that code didn't use IP_PKTINFO either.
>>
>
> I just discovered another "hidden" feature of Linux: You can bind to a
> multicast address. Thus if the bind() call in iptvstreamhandler.cpp, line
> 211 includes the multicast adress instead in ANY_HOST it actually works.
> Just tested. However as far as I can understand, using IP_PKTINFO is the
> "portable" way to do, for those OS who understands this option. But since
> mythtv currently is only Linux, does it matter ?
>

MythTV runs on Linux, MacOS, and Windows so it does...

Kevin

[Attachment #5 (text/html)]

<div class="gmail_extra"><div class="gmail_quote">On Sun, Apr 29, 2012 at 6:46 AM, \
Niels Ole Kirkeby <span dir="ltr">&lt;<a href="mailto:nok@kirkeby.nu" \
target="_blank">nok@kirkeby.nu</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">2012/4/28 Niels \
Ole Kirkeby <span dir="ltr">&lt;<a href="mailto:nok@kirkeby.nu" \
target="_blank">nok@kirkeby.nu</a>&gt;</span><br><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi<br><br>I was trying to figure out why devel/rtp didn&#39;t work for me 
and found a major (if you&#39;re struck by it) flaw in the multicast 
handling in MythTV. The problem is that my provider delivers streams 
like udp://222.111.222.xx:2000. That is for all streams the port-no is 
the same. In Linux, basically only the port-no differentiates the 
various udp-streams. Thus I noticed a strange phenomena in MythTV: two 
iptv-tuners recording two different streams but all data goes to the 
first stream !<br>
<br>I made a small test-program: Open two sockets, join two different multicast \
streams (udp://<a href="http://222.111.222.123:2000" \
target="_blank">222.111.222.123:2000</a> and udp://<a \
href="http://222.111.222.124:2000" target="_blank">222.111.222.124:2000</a>).  I \
noticed the bind() for the second socket failed. When I read from the  sockets, only \
the first socket has any data but the data was a merge  from both streams ! After \
some digging I found out that apparently you  can only have one common socket for all \
streams and should use sockopt  IP_PKTINFO to find the multicast group the data is \
for.<br> <br>I&#39;m not quite into the class-relations in MythTV yet but are trying 
to figure out how to handle this. Could anybody responsible for the 
devel/rtp branch please comment on this ? Whether this is &quot;just&quot; a patch
 or a major rewrite ?<br>
<br>What&#39;s strikes me is that appearently I only had minor problems 
whether the &quot;old&quot; IPTV code and that code didn&#39;t use IP_PKTINFO \
either.<div><div><img></div> </div>
</blockquote></div><br></div></div>I just discovered another &quot;hidden&quot; \
feature of Linux: You can bind to a multicast address. Thus if the bind() call in \
iptvstreamhandler.cpp, line 211 includes the multicast adress instead in ANY_HOST it \
actually works. Just tested. However as far as I can understand, using IP_PKTINFO is \
the &quot;portable&quot; way to do, for those OS who understands this option. But \
since mythtv currently is only Linux, does it matter ?<br>

</blockquote><div><br></div><div>MythTV runs on Linux, MacOS, and Windows so it \
does...</div><div><br></div><div>Kevin</div></div> </div>



_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://www.mythtv.org/mailman/listinfo/mythtv-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic