vlcj发出的多个请求

时间:2018-12-18 11:36:19

标签: video-streaming vlcj

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

我遇到了一些视频流问题,并且为vlcj启用了详细的输出,日志看起来非常奇怪:正在流文件的服务器上有很多请求(对于一个文件,有10个请求)。我注意到,在第一个调用后端之后,第二个si是由一个组合的“ 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

1 个答案:

答案 0 :(得分:0)

我敢猜测,这与您试图通过HTTP协议流式传输视频文件有关。

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

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