Icecast http 连接延迟超过 30 秒
Icecast http connection latency over 30 seconds
我正在 运行 安装 icecast 服务器 (2.4.3) 并经历了很长的 "time to first byte"。这很奇怪,因为这似乎不是播放器(如 mplayer)发生的,而是仅在使用 HTML5 音频时发生的。开始播放音频需要 30 秒到 120 秒。
我认为这不是缓冲问题,因为这段时间我似乎没有收到任何字节。例如,如果我 运行 带有详细标志的 curl 命令:
~ben ~: curl http://radio.example.com:8000/radio.mp3 -v
* Trying XX.XX.XX.XXX...
* TCP_NODELAY set
* Connected to radio.example.com (XX.XX.XX.XXX) port 8000 (#0)
> GET /radio.mp3 HTTP/1.1
> Host: radio.example.com:8000
> User-Agent: curl/7.51.0
> Accept: */*
>
在我看到任何字节进入之前,它会像这样至少等待 28 秒。相反,如果我 运行 mplayer:
~ben ~: mplayer http://radio.example.com:8000/radio.mp3
MPlayer 1.3.0-4.2.1 (C) 2000-2016 MPlayer Team
Can't init Apple Remote.
Playing http://radio.example.com:8000/radio.mp3.
Resolving radio.example.com for AF_INET6...
Couldn't resolve name for AF_INET6: radio.example.com
Resolving radio.example.com for AF_INET...
Connecting to server radio.example.com[XX.XX.XX.XXX]: 8000...
Cache size set to 320 KBytes
Cache fill: 0.00% (0 bytes)
ICY Info: StreamTitle='';
Cache fill: 5.00% (16384 bytes)
ICY Info: StreamTitle='';
Cache fill: 10.00% (32768 bytes)
ICY Info: StreamTitle='';
Cache fill: 15.00% (49152 bytes)
ICY Info: StreamTitle='';
ICY Info: StreamTitle='';
Audio only file format detected.
==========================================================================
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 57.24.102 (internal)
AUDIO: 44100 Hz, 2 ch, floatle, 128.0 kbit/4.54% (ratio: 16000->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [coreaudio] 44100Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
它缓冲并在几秒钟内开始播放。
Icecast 配置
以下是我认为的相关配置
<icecast>
<limits>
<clients>100</clients>
<sources>2</sources>
<queue-size>102400</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>1</source-timeout>
<burst-size>943718</burst-size>
<mp3-metadata-interval>4096</mp3-metadata-interval>
</limits>
<mount>
<mount-name>/radio.mp3</mount-name>
<password>*****************</password>
<bitrate>128</bitrate>
<type>audio/mpeg</type>
<subtype>mp3</subtype>
<hidden>0</hidden>
<fallback-mount>/whitenoise.mp3</fallback-mount>
<fallback-override>1</fallback-override>
</mount>
</icecast>
尝试修复
我已经在几个不同的版本上尝试过这个,包括 2.3.3、2.3.3-kh-11、2.4.0-kh4。过去我已经让它与 kh 分支一起正常工作,但我无法让后备安装与 kh 分支一起工作。我可能会放弃并尝试走下那个兔子洞。我也试过摆弄所有的突发和缓冲区配置,但这个问题似乎与那些无关。
在用尽我的选择后,我只是尝试从另一台计算机流式传输,但发现问题没有发生。我让其他人试了一下,他们确认他们没有在直播中看到这个问题。这让我相信问题出在我的电脑上(在这种情况下是流媒体客户端)。我怀疑它正在尝试将连接升级为 TLS 加密连接(以前在该域中发生过这种情况)但不确定。不管怎样,icecast 都不是问题。
我正在 运行 安装 icecast 服务器 (2.4.3) 并经历了很长的 "time to first byte"。这很奇怪,因为这似乎不是播放器(如 mplayer)发生的,而是仅在使用 HTML5 音频时发生的。开始播放音频需要 30 秒到 120 秒。
我认为这不是缓冲问题,因为这段时间我似乎没有收到任何字节。例如,如果我 运行 带有详细标志的 curl 命令:
~ben ~: curl http://radio.example.com:8000/radio.mp3 -v
* Trying XX.XX.XX.XXX...
* TCP_NODELAY set
* Connected to radio.example.com (XX.XX.XX.XXX) port 8000 (#0)
> GET /radio.mp3 HTTP/1.1
> Host: radio.example.com:8000
> User-Agent: curl/7.51.0
> Accept: */*
>
在我看到任何字节进入之前,它会像这样至少等待 28 秒。相反,如果我 运行 mplayer:
~ben ~: mplayer http://radio.example.com:8000/radio.mp3
MPlayer 1.3.0-4.2.1 (C) 2000-2016 MPlayer Team
Can't init Apple Remote.
Playing http://radio.example.com:8000/radio.mp3.
Resolving radio.example.com for AF_INET6...
Couldn't resolve name for AF_INET6: radio.example.com
Resolving radio.example.com for AF_INET...
Connecting to server radio.example.com[XX.XX.XX.XXX]: 8000...
Cache size set to 320 KBytes
Cache fill: 0.00% (0 bytes)
ICY Info: StreamTitle='';
Cache fill: 5.00% (16384 bytes)
ICY Info: StreamTitle='';
Cache fill: 10.00% (32768 bytes)
ICY Info: StreamTitle='';
Cache fill: 15.00% (49152 bytes)
ICY Info: StreamTitle='';
ICY Info: StreamTitle='';
Audio only file format detected.
==========================================================================
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 57.24.102 (internal)
AUDIO: 44100 Hz, 2 ch, floatle, 128.0 kbit/4.54% (ratio: 16000->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [coreaudio] 44100Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
它缓冲并在几秒钟内开始播放。
Icecast 配置
以下是我认为的相关配置
<icecast>
<limits>
<clients>100</clients>
<sources>2</sources>
<queue-size>102400</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>1</source-timeout>
<burst-size>943718</burst-size>
<mp3-metadata-interval>4096</mp3-metadata-interval>
</limits>
<mount>
<mount-name>/radio.mp3</mount-name>
<password>*****************</password>
<bitrate>128</bitrate>
<type>audio/mpeg</type>
<subtype>mp3</subtype>
<hidden>0</hidden>
<fallback-mount>/whitenoise.mp3</fallback-mount>
<fallback-override>1</fallback-override>
</mount>
</icecast>
尝试修复
我已经在几个不同的版本上尝试过这个,包括 2.3.3、2.3.3-kh-11、2.4.0-kh4。过去我已经让它与 kh 分支一起正常工作,但我无法让后备安装与 kh 分支一起工作。我可能会放弃并尝试走下那个兔子洞。我也试过摆弄所有的突发和缓冲区配置,但这个问题似乎与那些无关。
在用尽我的选择后,我只是尝试从另一台计算机流式传输,但发现问题没有发生。我让其他人试了一下,他们确认他们没有在直播中看到这个问题。这让我相信问题出在我的电脑上(在这种情况下是流媒体客户端)。我怀疑它正在尝试将连接升级为 TLS 加密连接(以前在该域中发生过这种情况)但不确定。不管怎样,icecast 都不是问题。