【问题标题】:Multiple requests made by vlcjvlcj 发出的多个请求
【发布时间】:2018-12-18 11:36:18
【问题描述】:

我正在使用 vlcj 读取位于 URL 的媒体文件。

我遇到了一些视频流问题,我为 vlcj 启用了详细输出,日志看起来很奇怪:向正在流式传输文件的服务器发出了许多请求(只有一个文件有 10 个请求)。我注意到在第一次调用后端之后,第二个是用一个组成的“范围”标题(或者可能有一个逻辑,但我错过了它)。之后,再次发出相同的请求,并在某个时候更改“Range”标头值并保持为新值,依此类推。

问题是vlc发出这么多请求是否正常,重复请求的目的是什么。

我也在此处发布正在提出的请求。

> [1dcb6130] http stream debug: outgoing request:   streaming?id=1011122
> HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Range: bytes=0-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: incoming response:    HTTP/1.1 200 200
> 
>   Date: Tue, 18 Dec 2018 10:35:54 GMT
> 
>   Server: Apache/2.4.6 (CentOS) mod_jk/1.2.42
> 
>   Set-Cookie: JSESSIONID=ASD43SAD123SAD34;path=/;HttpOnly
> 
>   Accept-Ranges: bytes
> 
>   Content-Length: 31380626
> 
>   Content-Type: video/mp4
> 
>   [1dcb6130] http stream debug: outgoing request:     GET
> /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=31188554-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: incoming response:    HTTP/1.1 200 200
> 
>   Date: Tue, 18 Dec 2018 10:35:54 GMT
> 
>   Server: Apache/2.4.6 (CentOS) mod_jk/1.2.42
> 
>   Set-Cookie: JSESSIONID=0ASD43SAD123SAD34;path=/;HttpOnly
> 
>   Accept-Ranges: bytes
> 
>   Content-Length: 192072
> 
>   Content-Type: video/mp4     [1dcb6130] http stream debug: outgoing
> request:  GET /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=0ASD43SAD123SAD34
> 
>   Range: bytes=31188554-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: connection failed     [1dcb6130] http
> stream debug: resolving hostname.com ...  [1dcb6130] http stream
> debug: outgoing request:  GET /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=0ASD43SAD123SAD34
> 
>   Range: bytes=31188554-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: incoming response:    HTTP/1.1 200 200
> 
>   Date: Tue, 18 Dec 2018 10:35:55 GMT
> 
>   Server: Apache/2.4.6 (CentOS) mod_jk/1.2.42
> 
>   Set-Cookie: JSESSIONID=ASD43SAD123SAD34;path=/;HttpOnly
> 
>   Accept-Ranges: bytes
> 
>   Content-Length: 192072
> 
>   Content-Type: video/mp4
> 
>   [1dcb6130] http stream debug: outgoing request:     GET
> /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=4847078-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: connection failed     [1dcb6130] http
> stream debug: resolving hostname.com ...  [1dcb6130] http stream
> debug: outgoing request:  GET /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=4847078-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: incoming response:    HTTP/1.1 200 200
> 
>   Date: Tue, 18 Dec 2018 10:36:21 GMT
> 
>   Server: Apache/2.4.6 (CentOS) mod_jk/1.2.42
> 
>   Accept-Ranges: bytes
> 
>   Content-Length: 26533548
> 
>   Content-Type: video/mp4
> 
> 
> 
> 
>   [1dcb6210] prefetch stream error: cannot seek (to offset 4847078)
>   [1dcbd7e8] avi demux warning: failed reading data   [1dcb6130] http
> stream debug: outgoing request:   GET /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=4900374-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: connection failed     [1dcb6130] http
> stream debug: resolving hostname.com ...  [1dcb6130] http stream
> debug: outgoing request:  GET /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=4900374-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: incoming response:    HTTP/1.1 200 200
> 
>   Date: Tue, 18 Dec 2018 10:36:22 GMT
> 
>   Server: Apache/2.4.6 (CentOS) mod_jk/1.2.42
> 
>   Accept-Ranges: bytes
> 
>   Content-Length: 26480252
> 
>   Content-Type: video/mp4
> 
> 
> 
> 
>   [1dcb6210] prefetch stream error: cannot seek (to offset 4900374)
>   [1dcb6130] http stream debug: outgoing request:     GET
> /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=4847078-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: connection failed     [1dcb6130] http
> stream debug: resolving hostname.com ...  [1dcb6130] http stream
> debug: outgoing request:  GET /streaming?id=12345678 HTTP/1.1
> 
>   Host: hostname.com
> 
>   Accept: */*
> 
>   Accept-Language: en_US
> 
>   User-Agent: VLC/3.0.4 LibVLC/3.0.4
> 
>   Cookie: JSESSIONID=ASD43SAD123SAD34
> 
>   Range: bytes=4847078-
> 
> 
> 
> 
>   [1dcb6130] http stream debug: incoming response:    HTTP/1.1 200 200
> 
>   Date: Tue, 18 Dec 2018 10:36:23 GMT
> 
>   Server: Apache/2.4.6 (CentOS) mod_jk/1.2.42
> 
>   Set-Cookie: JSESSIONID=ASD43SAD123SAD34;path=/;HttpOnly
> 
>   Accept-Ranges: bytes
> 
>   Content-Length: 26533548

【问题讨论】:

    标签: video-streaming vlcj


    【解决方案1】:

    我大胆猜测一下,这与您尝试通过 HTTP 协议流式传输视频文件有关。

    由于 HTTP 流式传输使用文件的“播放列表”来检索视频,因此在流式传输单个视频时会发出多个请求。 (您不希望在播放之前必须下载完整的文件,因为它不再是“流式传输”而是播放本地下载的文件。)

    如果它只是一个文件,它可能会从同一个文件的每个请求中请求几个 Mb:s,以便能够缓冲文件而不是下载它。

    【讨论】:

    • 我期待你说的同样的事情(“请求更多 mb 以构建缓冲区”),但事实并非如此:请求不是使用 byte 标头,但随机值。我还发布了日志文件,我知道它很难阅读,但它显示了这些请求的随机性。
    • 好吧,在这种情况下,我会说它与 vlcj 无关,因为(据我所知)vlcj 只是 VlcLib C 库的包装器。
    猜你喜欢
    • 2017-02-27
    • 1970-01-01
    • 1970-01-01
    • 2011-01-08
    • 2015-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多