c4valli / kodi-fcast-receiver

FCast receiver add-on for Kodi
GNU General Public License v2.0
10 stars 1 forks source link

Enable MPEG-Dash content #2

Closed xlash123 closed 11 months ago

xlash123 commented 11 months ago

I was able to get MPEG-Dash working (at least with Grayjay). I took a look at how the YouTube addon does MPEG-Dash. It uses the InputStream Adaptive addon, so I marked that as a requirement in addon.xml.

For delivering, I chose the same approach as test.py, making an HTTP server to deliver the MPD manifest via a URL, which was accepted by InputStream Adaptive.

This also fixes a bug with seeking, where if the client sends many seek packets, Kodi would normally freeze up as it tries to process them all. Instead, only the last one send within a 150ms timespan gets through.

There is one bug in this code that I couldn't resolve. When sending a Stop packet from the FCast client, Kodi freezes up for about 30 seconds. I can't see anything in my code that would cause blocking. My guess is it has to do with the HTTP request to the mdp manifest. Some related logs are below, which appear after the stop packet:

CCurlFile::Stat - <http://localhost:34755/stream.mpd> Failed: Timeout was reached(28)
...
127.0.0.1 - - [19/Nov/2023 21:50:16] code 501, message Unsupported method ('HEAD')
127.0.0.1 - - [19/Nov/2023 21:50:16] "HEAD /stream.mpd HTTP/1.1" 501 -
127.0.0.1 - - [19/Nov/2023 21:50:16] code 501, message Unsupported method ('HEAD')
127.0.0.1 - - [19/Nov/2023 21:50:16] "HEAD /stream.mpd HTTP/1.1" 501 -
xlash123 commented 11 months ago

\^ That force push was just me rebasing with main

sguerrini97 commented 11 months ago

I was messing around locally with InputStream helper (script.module.inputstreamhelper) and I couldn't get MPD to play without an HTTP server.

Playing an MPD from a local file didn't work either (e.g. saving message.content as /tmp/stream.mpd), I noticed this with mpv too and that's why I resorted to the HTTP server in test.py.

Anyway this works fine, I'll probably just merge your changes and enjoy it for now 🙂 I feel like the HTTP server is a bit overkill, it would be great to just pass the MPD content intead of the URL but I guess that's something to be implemented on the InputSteam Adaptive side.

Thank you!

sguerrini97 commented 11 months ago

@xlash123 I merged your changes and created 3 issued with the bug you reported and some minor ones I have found