PDA

View Full Version : BBCiPlayer - possible fix for live stream start delay on Windows systems



bpa
2018-12-17, 03:23
I think I have found a fix for the start delay of live streams on Windows 10 systems for player that need transcoding (e.g. Boom, SB3, Transporter). As this is a test which may have iterations & interactions, I have started this new thread to avoid cluttering up main support thread on what might be a dead end..

I'd like to have this fix tested on a variety of systems and on UK higher speed streams.

The fix requires LMS to be a build of 7.9.1 and later than 6-Jul-2017 as the fix depends on a bug fix to LMS.

If LMS is 7.9.0 or earlier then the code change will not be activated and so no change in playback.

If LMS does not have the 6-Jul-2017 fix then, when playing live BBC stream on device which can play AAC natively (e.g Radio, Touch, Squeezelite) the server.log will get filled with very very many "Error: Select task failed " messages - depending on start delay.

I have attached a replacement DASH.pm file. I have tested on a Win 10 system which had start problems and on a Win 7 which did not. I have also tested on an Ubuntu system.

Please report if there are any side effects such as increased CPU load.

Initially I am not releasing a repo with the fix to avoid splitting the user base which happened with previous test updates.

Instructions - read all the steps before trying them.

1. Download the attached file DASH.pm.txt into a known directory (e.g. Downloads)
2. Stop LMS.
3. Use File Manager to open directory with BBCiPlayer plugin file - usually \ProgramData\Squeezebox\Cache\InstalledPlugins\Plu gins\BBCiPlayer - to see directory you may need to enable "Show hidden files and folders" under File Explorer Options.
4. Copy the downloaded DASH.pm.txt file into the BBCiPlayer plugin directory
5. Rename the current DASH.pm to DASH.pm.org - saving the file makes it easier to revert.
6. Rename the DASH.pm.txt to DASH.pm
7. Start LMS and test with "Seconds to start live stream" set to "no delay"

Man in a van
2018-12-17, 03:54
Just given this a quick test.

No difference, set at "no delay" average time 14 secs to hearing sound. I used three separate stations into a Squeezebox radio.

First I had to enable "Show hidden files and folders" under File Explorer Options (Appearance and Personalisation) in Control Panel.


Intel i7 CPU 860 @ 2.80GHz
8GB ram, 64 bit.
Windows 10Pro version 1803 OS build 171344.471


Logitech Media Server Version: 7.9.2 - 1544453860 @ Mon Dec 10 16:08:31 WEST 2018
Hostname: Cooler-Master
Server IP Address: 192.168.*.*
Server HTTP Port Number: 9000
Operating system: Windows 10 - EN - cp1252
Platform Architecture: 8664
Perl Version: 5.14.1 - MSWin32-x86-multi-thread
Audio::Scan: 0.95
IO::Socket::SSL: 2.024
Database Version: DBD::SQLite 1.58 (sqlite 3.22.0)
Total Players Recognized: 1

ronnie

bpa
2018-12-17, 04:12
Just given this a quick test.

No difference, set at "no delay" average time 14 secs to hearing sound. I used three separate stations into a Squeezebox radio.

The long standing problem that it is fixing wasn't showing with Radios etc. which can play AAC natively - just device which need transcoding - Boom, SB3, receiver etc..

Do you have aporblem with Radio playing live streams ?



First I had to enable "Show hidden files and folders" under File Explorer Options (Appearance and Personalisation) in Control Panel.


Forgot this on a Win 10 nanny system.

bpa
2018-12-17, 04:18
Ronnie,
your log has this


18-12-17 10:39:48.4984] Slim::Utils::Misc::msg (1252) Warning: [10:39:48.4980] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.
[18-12-17 10:39:48.4993] Slim::Utils::Misc::msg (1252) Warning: [10:39:48.4990] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.
[18-12-17 10:39:48.5003] Slim::Utils::Misc::msg (1252) Warning: [10:39:48.5000] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.
[18-12-17 10:39:53.5652] Plugins::BBCiPlayer::DASH::__ANON__ (780) Chunk fetch status 200 Long chunk fetch time 12117 1000
[18-12-17 10:39:53.5786] Plugins::BBCiPlayer::DASH::__ANON__ (780) Chunk fetch status 200 Long chunk fetch time 12127 1000
[18-12-17 10:39:53.5961] Plugins::BBCiPlayer::DASH::__ANON__ (780) Chunk fetch status 200 Long chunk fetch time 12146 1000
[18-12-17 10:40:29.5484] Slim::Utils::Misc::msg (1252) Warning: [10:40:29.5481] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.


1. BBC is taking 12 secs to reply to requests.
2. Strange error with AnyEvent/DNS.pm. Don't know where this is coming from.

Man in a van
2018-12-17, 05:34
Do you have a problem with Radio playing live streams ?

No, just the delay if using a Windows server







Ronnie,
your log has this


18-12-17 10:39:48.4984] Slim::Utils::Misc::msg (1252) Warning: [10:39:48.4980] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.
[18-12-17 10:39:48.4993] Slim::Utils::Misc::msg (1252) Warning: [10:39:48.4990] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.
[18-12-17 10:39:48.5003] Slim::Utils::Misc::msg (1252) Warning: [10:39:48.5000] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.
[18-12-17 10:39:53.5652] Plugins::BBCiPlayer::DASH::__ANON__ (780) Chunk fetch status 200 Long chunk fetch time 12117 1000
[18-12-17 10:39:53.5786] Plugins::BBCiPlayer::DASH::__ANON__ (780) Chunk fetch status 200 Long chunk fetch time 12127 1000
[18-12-17 10:39:53.5961] Plugins::BBCiPlayer::DASH::__ANON__ (780) Chunk fetch status 200 Long chunk fetch time 12146 1000
[18-12-17 10:40:29.5484] Slim::Utils::Misc::msg (1252) Warning: [10:40:29.5481] EV: error in callback (ignoring): substr outside of string at /<C:\PROGRA~2\SQUEEZ~1\server\SQUEEZ~3.EXE>AnyEvent/DNS.pm line 534.


1. BBC is taking 12 secs to reply to requests.
2. Strange error with AnyEvent/DNS.pm. Don't know where this is coming from.

Just tried 2 stations on a Boom, same delay time

I don't often use the LMS on the Windows Desktop, just keep it rolling as a backup really.

ronnie

bpa
2018-12-17, 06:15
Just tried 2 stations on a Boom, same delay time

Hmmm. You're still getting long 12 sec delay from BBC - which seems too similar to the delay you are experiencing and since you get the delay with Radio - I'm not convinced it is the same issue.

You've also got the frequent AnyEvent/DNS.pm error which I don't see - again possibly nothing to do with BBCiPlayer plugin but it is happening every 5-6 secs which is about the time period for BBC chunks - it makes me suspicious. Our system specs are very similiar, same LMS build, I use Win 10 Home i7-8700 @ 3.2GHz

What is your DNS server setting on Windows ?

Man in a van
2018-12-17, 07:49
Hmmm. You're still getting long 12 sec delay from BBC - which seems too similar to the delay you are experiencing and since you get the delay with Radio - I'm not convinced it is the same issue.

You've also got the frequent AnyEvent/DNS.pm error which I don't see - again possibly nothing to do with BBCiPlayer plugin but it is happening every 5-6 secs which is about the time period for BBC chunks - it makes me suspicious. Our system specs are very similiar, same LMS build, I use Win 10 Home i7-8700 @ 3.2GHz

What is your DNS server setting on Windows ?

Well, DNS is a bit out of my comfort zone.

I checked here

26273

Blank as you can see.

I have in the past flushed the DNS several times, so tried that again, but it made no difference.

I then chnaged the Router settings from

26274

to

26275

Rebooted and played BBC radio3 into the Boom, no change.

Is it worth resetting the router , do you think? Everything seems to be working fine:(

I would not want your new thread, to start off, going up a creek (if you see what I mean:))

ronnie

bpa
2018-12-17, 08:18
Well, DNS is a bit out of my comfort zone

I'm using same DNS - google. The error points to a line parsing the DNS reply which is very odd as this code has been unchanged for years except for one change in last month but I'm using same version.

I'm now not sure whether your BBC long delays are due to BBC being late or the DNS failing or a combination but the DNS error does not happen anywhere else except when playing BBCiplayer - they do seem to be linked. I wonder if it is a side effect of the change in the new DASH.pm file.

If you revert back to the original DASH.pm - do you get the same long delays and DNS error ?

Man in a van
2018-12-17, 08:41
If you revert back to the original DASH.pm - do you get the same long delays and DNS error ?

Yep,

reverted to the original file and rebooted.

Tried radio 6 and it seemed to take a long time

Changed to radio 3 and ued my timer, 52 sec before I could hear the playback.

bpa
2018-12-17, 09:05
Yep,

reverted to the original file and rebooted.

Tried radio 6 and it seemed to take a long time

Changed to radio 3 and ued my timer, 52 sec before I could hear the playback.

Thanks, OK that's good. It means fix seems to do something right on your system and DNS error is still there so it is not a side-effect of the change.

Owen Smith
2018-12-18, 02:52
I can't help with testing this, I use a WHS v1 server on an Intel Atom processor which does not suffer startup issues. And I'm on LMS 7.8.0 anyway which can't use the fix.

bpa
2018-12-18, 03:13
I can't help with testing this, I use a WHS v1 server on an Intel Atom processor which does not suffer startup issues. And I'm on LMS 7.8.0 anyway which can't use the fix.

I think your system is not affected because either or both Atom processor and WHS v1.

AFAICT the problem stems from a convergence of issues.
1. DASH uses a "mechanism" from Triode HLS code (and before that RTMP/Flash) but Triode had to change RTMP code to make it work for HLS to workaround a bug in LMS but I think at the time he didn't know it was a bug.
2. The workaround fails when faster/multicore processors an/or change in kernel scheduler in Win 10 (possibly 8 maybe 7) which start the transcoding process very quickly. The issue does not seem to affect Linux possibly because processes seemed to be started in a more orderly fashion.
3. July 2017 Bug fix in LMS 7.9.1 enable DASH & HLS code to be changed to revert code back to original RTMP mechanism.

While the LMS change is a simple one line to a single file - on Windows LMS is delivered as a single EXE and so individual LMS files cannot be patched.

bpa
2018-12-18, 16:50
I just tested on my low end Windows system - an old XP laptop which has a 1.7GHz 2 core Pentium 1.25Gb ram

Playing live Windows stream
Without the fix - start delay is either 30 secs or use 1 min delay in setting for immediate playback.
With the fix - immediate playback with no delay in settings.

Owen Smith
2018-12-19, 00:34
I just tested on my low end Windows system - an old XP laptop which has a 1.7GHz 2 core Pentium 1.25Gb ram

Playing live Windows stream
Without the fix - start delay is either 30 secs or use 1 min delay in setting for immediate playback.
With the fix - immediate playback with no delay in settings.

That is very similar in spec to my WHS v1 Intel Atom LMS system. I have the defaults for delays in iPlayer plugin, I don't know what the defaults are and I can't check at present.

Main difference is Atom N270 has one core with two hyper threads, so if your Pentium is genuinely 2 core it may behave differently.

bpa
2018-12-19, 02:44
That is very similar in spec to my WHS v1 Intel Atom LMS system. I have the defaults for delays in iPlayer plugin, I don't know what the defaults are and I can't check at present.

Main difference is Atom N270 has one core with two hyper threads, so if your Pentium is genuinely 2 core it may behave differently.
I'm pretty sure it has 2 cores as it had a sticky "Core 2" and "Centrino" but the fix seemed to help an XP system which surprised me.

Before releasing the fix as part of an 1.6.2 update, I'd like feedback from users such as bstrulo who have a serious problem with BBC Live streams where connection/playback is unreliable even at delay setting more than 2 minutes.

The fix can be applied to LMS earlier than 7.9.1 such as your 7.8.0 and it works when playback is transcoded but for devices which have native AAC (e.g. Radio, Touch, Squeezelite) - the log file would be filled with an LMS error message.

tdrath
2018-12-21, 12:18
I run my server on Windows 10 and use the Squeezeplay controller to play to a sync'd receiver and Touch. It has been working OK, with occasional rebuffering issues, but nothing too bad. Sometimes it takes a while to get started.

Listening to 6Music this afternoon, I started suffering repeated buffering problems. Maybe to do with applying the October Update to Windows 10 at lunchtime today.

I was running BBC iPlayer plugin v1.6.1. After stopping and restarting the server to try to fix it, I wasn't sure what to try next, as it would be irritiating not to be able to rely on the Squerezebix to listen to the radio over the Christmas break. So tried this patch and restarted my server and it ran smoothly for an hour.

I'm using the default settings: no delay, buffer fullness=255.

My system is an i7-2800T @2.8GHz with 32Gb RAM, running the latest version of LMS: Logitech Media Server Version: 7.9.2 - 1545144292 @ Tue Dec 18 16:08:15 WEST 2018 on Windows 10 Pro version 1809 OS build 17763.194. I am based in the UK, with no VPN. I use DASH for Live Streams and On Demand.

So I think the patch works. If you want any more information or logs, let me know.

bpa
2018-12-21, 16:36
So I think the patch works. If you want any more information or logs, let me know.

Thanks for the trying the patch. While I never got the rebuffering on my test system, others have reported this symptom. No need for logs etc at this stage - just report if you notice any side effects or problem that could be assocuated with patch.

SMC
2018-12-22, 12:01
I've just tried this on my Windows system and it transforms 10-20 second delay starting live streams to <1 second. I can catch it out by repeatedly switching back and forth between streams, but delay in this case is still only a second or two at most. No untoward behaviours noted yet.

- BBC iPlayer plugin set to DashFLAC>DASH, no delay, 255kb buffer fullness threshold.
- all testing using Boom as receiver
- Windows 10 Pro 64 bit build 1803, Intel Celeron 1017U 1.6GHz (2 core processor)

Thanks very much for this fix, which might tempt me back to using this low powered Windows system as my LMS again - the buffering issue had caused me to move LMS onto my QNAP NAS but this has a few quirks of it's own.

Edited to add - this is with UK 320k streams

bpa
2018-12-22, 14:01
I've just tried this on my Windows system and it transforms 10-20 second delay starting live streams to <1 second. I can catch it out by repeatedly switching back and forth between streams, but delay in this case is still only a second or two at most. No untoward behaviours noted yet.

- BBC iPlayer plugin set to DashFLAC>DASH, no delay, 255kb buffer fullness threshold.
- all testing using Boom as receiver
- Windows 10 Pro 64 bit build 1803, Intel Celeron 1017U 1.6GHz (2 core processor)

Thanks very much for this fix, which might tempt me back to using this low powered Windows system as my LMS again - the buffering issue had caused me to move LMS onto my QNAP NAS but this has a few quirks of it's own.

Edited to add - this is with UK 320k streams
Thanks for feedback.

I expect a little bit of delay if swapping BBCiplayer live streams as there is a bit of housekeeping to shut down a stream before another can start. With UK 320k streams as data rate is high, startup will be quicker and you may even get away with 100kb buffer size -that may make start a little bit quicker.

I'll probably release a 1.6.2 after Christmas with this patch included.