New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed: Some (Silverlight) servers don't play nice with CURLOPT_RESUME_... #2187
Conversation
@elupus, this is a followup for PR2179. The silverlight streams now play nice with Libcurl although there's still something weird going on: after a seek, dvdplayer keeps seeking back in the stream causing the file cache to never fillup. You can see this here: http://pastebin.ubuntu.com/1611686/ |
@@ -248,10 +248,24 @@ bool CCurlFile::CReadState::Seek(int64_t pos) | |||
return false; | |||
} | |||
|
|||
long CCurlFile::CReadState::Connect(unsigned int size) | |||
|
|||
void CCurlFile::CReadState::AddEasyToMultiHandle(void) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Could you post the difference this patch makes to the http request. On Tue, Feb 5, 2013 at 8:56 AM, arnova notifications@github.com wrote:
|
Curl WITH Range Opt: http://pastebin.com/M4DGVm8X Note that this still doesn't completely fix seeking with Silverlight streams. There's still something strange going on in DVDPlayer. After a seek, vq never returns to 100% rather to 30% (where aq is 100%) and slow decreases until playback stalls. In the meantime ffmpeg keeps seeking back in the stream (as shown by the logs). As if after a seek there's all of a sudden some poor interleave/delay between a/v. I also tried the ffplay of OUR ffmpeg and that works fine with the same stream. Any ideas? |
That is just strange. There are no range requests at all in one of the |
Maybe related: Daniel S (25 April 2007)
|
Well that doesn't explain why CURLOPT_RANGE partially fixes the issue, right? Also note that there seem to be 2 issues at play here:
|
@elupus: Had another look on what happens without this patch with one of my own http servers when playing video files and seeking. This has also works as it should. In thise case Curl debug shows this: Curl::Debug Range: bytes=45525318- So apparently both (=content-range & range) get set when seeking is working properly. But somehow under certain situations (on redirects?) the RANGE-option needs to be set explicitly which is what is done with this PR. It therefor seems a safe workaround for the issue. I think this may be some bug or weird behavior (we don't understand) in libcurl itself, not sure. I've already debugged this issue extensively but this PR is the only thing that seems to remedy it. |
@ulion : Since you've been doing some Curl stuff as well: Do you have any ideas about this? |
Range was set by request client, Content-Range is the server response. |
@arnova can you give me an url like the one in your pastebin log current can play, the one in log seems expired. |
The streams use session-tokens so I can't provide one directly. Just install this addon: http://www.rieter.net/ext/?uri=http://xot.hamans.com/net.rieter.xot-3.3.3.zip . In the addon go to "Uitzendinggemist.nl" (the one on top), go to "Vandaag (....)" and select one of the items in the list (they may not all work due to copyright restrictions outside of NL). |
they can be played on my working build, with some patches related to mp4 |
That's exactly the problem that is fixed by applying this PR/patch: seeking outside cache causes XBMC to freeze (or sometimes even crash). With this patch (and your cache patch in the other PR) all is well (I've been running a patched version on my HTPC for a few weeks now and that seems to working well). Note that I also did some digging in the Curl source and one thing I noticed is the fact that there are some places in http.c where RESUME_FROM is "handled" where RANGE is not which probably explains why this PR fixes the problem for me. I suspect some bug in libcurl causing RESUME_FROM data being reset (eg. with redirects?) where RANGE data is not. Just look for all "state.resume_from"-references in http.c and you'll see what I mean. |
current xbmc code indeed seek on the stream, but the result data in
|
Problem confirmed, it's the server problem, it send out video file with different content-length with or without Range request, that's why the patch in this pr can workaround the problem, but it's really a server related case, should not be considered as a common situation:
response with Range:
|
But from my sight, there's no way the addon can do to workaround it, since the server return different video file according whether the request include Range request, and I tested force add "Range: bytes=0" header will break the play, then we have to workaround it in CurlFile.
|
Ping @elupus |
If tested to not break ftp access, it's fine by me. |
oh, ftp, then RESUME_FROM_LARGE should always be set, and RANGE is only needed when m_filePos == 0 with a comment about why it is needed: we need always send Range header since RESUME_FROM_LARGE will not send Range request header when it set to 0, but some server, e.g. xxx.xxx.xx rely on this else will return different file content which will cause seek failure. |
@ulion: CURL_OPT_RANGE also works with FTP (tested it myself), so that isn't a problem. Only thing we need to decide is the best approach... |
oh~, I checked the curl code, it did revert it from range string back to off_t, then only use RANGE is ok. |
Will do. Then we can continue work on PR2229 :p |
…uest header is not set causing seeking to fail. To fix this use CURL_OPT_RANGE method instead of CURLOPT_RESUME_FROM_LARGE
changed: Some (Silverlight) servers don't play nice with CURLOPT_RESUME_...
badly, I encounter some http servers will response 502 when request with 'Range: bytes=0-' header, but if request once without the Range header, it will then can accept request with Range header on the same url. good news is addon can add 'Range=' protocol option to such urls, then curl will not send Range header for these image urls. |
We could also simply detect response 502 and try without Range: bytes=0- the first time, right? |
this may be server specific problem, and maybe not a common way to do that, at least currently we have a workaround for that. |
fixed: Some (live) streams no longer played since the Curl seek fix (fix...
...FROM_LARGE, those need CURL_OPT_RANGE