XBMC + UPnP update – No SSDPProxy needed!

July 3, 2006 20 comments

I haven’t done that in a long time but I pulled an allnighter today. From 9pm to 9am, working around the clock to fix the last bugs that spiff found. He couldn’t get to see Windows Media Connect. I remembered WMC didn’t seem to respond to M-SEARCH requests. Poking around the internet, I found out that actually it doesn’t respond to M-SEARCH requests issued from the same machine where WMC runs. So the whole Ssdp Proxy solution would work only if it was running on a different machine than WMC. So I was a little worried… But THEN I noticed something very strange. WMC would respond to M-SEARCH requests issued from the same machine when using Intel UPnP Sniffer in unicast mode. Somehow, the UPnPHost service had a bug that could help me!
After a few hours of debugging, I figured out that I was not setting the Host header on my SSDP packets and that UPnPHost was requiring it. After I added it (and it needed to be 239.255.255.250:1900 regardless of the destination), it worked fine. But the most amazing thing about it is that SsdpProxy is NOT required anymore! The xbox can send directly on port 1900 in unicast and wmc will respond to it (as long as it’s the only one listening on that port on the machine of course).

This is very exciting stuff. You don’t even need to set the port in the sources.xml anymore. Actually you don’t even need to add anything. XBMC has got a cool feature that lets you add new Network Locations from within xbmc, including upnp now thanks to spiff. He must have thought I was an idiot cause I couldn’t figure out what he was talking about (root bookmark, add network location, huh?).

Big thanks to spiff also for letting me become an official dev on the xbmc team. I got to meet pike, Donno, DeanPerry (aka C-Quel), jmarshall & Sollie so far. Very nice people. I’ll try to help as much as I can and not f*ck up the repo.

Long live XBMC.

Oh and it looks like the xbmc forums have been updated already about the subject ;-).

Sourceforge

June 23, 2006 1 comment

By the way, Platinum 0.1.0.0 is now available on Sourceforge. Enjoy.

XBox + Windows Media Connect

June 23, 2006 3 comments

I must be on a roll or something but tonite I was able to implement my multicast work around and I can now see more than 1 upnp servers. Check the result out.

So how does this workaround work? Well it’s quite easy. The xbox cannot send multicast so you need to specify which IP address the xbox should send the M-SEARCH packets to. That’s what you put in the XboxMediaCenter.xml Sources.xml as upnp://host:port.

The default port is not 1900 but 1901. The reason is that if you send a unicast udp packet to a port that is being used by multiple applications, only one will receive it wether or not they are expecting a multicast packet or not. So if you have multiple upnp apps on your host all listening on port 1900 for multicast packets, and you send unicastly instead of multicastly only one will receive it. Of course, most people don’t know but Windows has a service called SSDP which listens to 1900 and of course it’s the first one to receive the unicast packets that the xbox sends. So no other apps (UPnP Media Servers) running on Windows and not using this Service will not receive anything. Interestingly this Service is being used by all UPnP applications Microsoft comes out with, including Windows Media Connect. Go figure!
So now the proxy. By default, it has to listen on a different port than 1900 as explained above. So I chose 1901 but it’s configurable in the command line in case that port is ever going to be used by someone else. The proxy requires an exclusive access to the port (by binding it) to make sure it’s the only one listening on it to guarantee delivery. Of course remember to change the setting in the XboxMediaCenter.xml Sources.xml if you do change it.

When the proxy receives a SSDP unicast M-SEARCH from the xbox on port 1901 (or the one you specified), it creates a multicast socket and forwards the request to the regular UPnP address (239.255.255.250), and then waits for responses. Devices should respond to the proxy which then forwards back the responses to the xbox.

The proxy also listens for multicast announcement packets on port 1900. That way it can detect when a new UPnP device joins (or leaves) the network. When receiving a unicast request from the xbox, the proxy keeps around the ip address of the xbox and when multicast packets sent by UPnP devices are received by the proxy, it forwards them as well to the xbox (ip). It also works when devices go away but unfortunately, I have no way to asynchronously notify xbmc to update the UI (yet).

I just need to get the timeout working with blocking sockets which G. said he would add to Neptune soon.

I talked to spiff tonite again, I am going to publish all that tomorrow. Cheers!

Xbox + UPnP

June 21, 2006 2 comments

A while back, I ported Rhapsody to the Xbox when I was working at Listen.com. It’s been a while but after seeing the latest XBMC 2.0 with 360 skin, I really wanted to do something with it again. Since I had just finished Platinum, I decided to port it. The main problem that people encountered when trying to port UPnP to the Xbox is that the Xbox doesn’t support Multicast (sending and receiving) and since Multicast is required for bootstrapping (SSDP), I had to find another way (which I’ll describe later).

Anyway, after a full night of coding and a little bit today, I was able to get it going with the help of spiff on Efnet #xbmc. See the video here and here.

Plutinosoft Platinum Category

May 16, 2006 No comments yet

In preparation to release Platinum, I upgraded WordPress to 2.02 and made permalinks work. So now, all Platinum related entries will be found here. Now I just need to remove that lame header “Archive for the Platinum Category”.

SourceForge.net: Platinum

May 16, 2006 1 comment

I finally decided to release Platinum, my UPnP SDK. It will be hosted by Sourceforge for now. It will have a dual license: GPL + Commercial. I have spent the last few days trying to clean it up a bit (mainly removing the Windows Media Connect and Xbox 360 hacks). In doing so, I realized that I really needed to rewrite it . The pull model I have used is not very bandwidth efficient. The reason is that I am running a bunch of “tasks” in a round robin way and sleeping in between tasks for 30 ms. So for example, the maximum throughput I am getting while transferring a file locally (from the UPnP Media Server using wget), is only 4 MB/s. The Intel MediaServer on the other hand can go up to 17MB/s. It’s not really a problem for now (as I have used Platinum to stream audio+video from a PC to a PSP wirelessly without a glitch) but it bugs me it’s so slow. Hopefully once gilles releases Mikado, I’ll switch to using that.


Categories

Archives