From 186320ee25f81f9dadf749133f36b23776432d6f Mon Sep 17 00:00:00 2001 From: Philippe G Date: Mon, 2 Aug 2021 11:19:59 -0700 Subject: [PATCH 1/3] add "audio startup time" only when sample rate is 44.1 Otherwise, as silence inserted at the beginning will be at 44.1, player will set for 44.1 and if track uses another rate, it will be misplayed --- Slim/Player/Source.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Slim/Player/Source.pm b/Slim/Player/Source.pm index 039f30ee8c4..7384d58bb17 100644 --- a/Slim/Player/Source.pm +++ b/Slim/Player/Source.pm @@ -289,7 +289,7 @@ sub _readNextChunk { my $endofsong = undef; - if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3') { + if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3' && $client->streamingSong()->samplerate() == 44100) { my $silence = 0; # use the maximum silence prelude for the whole sync group... From ff97955081986ebcff48d4b6528dad5a22059c56 Mon Sep 17 00:00:00 2001 From: Philippe G Date: Mon, 2 Aug 2021 18:03:41 -0700 Subject: [PATCH 2/3] accept 32/48kHz silence as well non-lazy version --- HTML/EN/html/lbrsilence-32.mp3 | Bin 0 -> 432 bytes .../EN/html/{lbrsilence.mp3 => lbrsilence-44.mp3} | Bin HTML/EN/html/lbrsilence-48.mp3 | Bin 0 -> 288 bytes Slim/Player/Source.pm | 7 ++++--- Slim/Web/HTTP.pm | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 HTML/EN/html/lbrsilence-32.mp3 rename HTML/EN/html/{lbrsilence.mp3 => lbrsilence-44.mp3} (100%) create mode 100644 HTML/EN/html/lbrsilence-48.mp3 diff --git a/HTML/EN/html/lbrsilence-32.mp3 b/HTML/EN/html/lbrsilence-32.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..675b4514e759701accd6dfd365f7468a3acfc67f GIT binary patch literal 432 tcmezWyCTK1{{sUstreamingSong()->currentTrack->samplerate(); - if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3' && $client->streamingSong()->samplerate() == 44100) { + if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3' && $samplerate >= 32000) { my $silence = 0; # use the maximum silence prelude for the whole sync group... @@ -305,8 +306,8 @@ sub _readNextChunk { 0 && $log->debug("We need to send $silence seconds of silence..."); while ($silence > 0) { - $chunk .= ${Slim::Web::HTTP::getStaticContent("html/lbrsilence.mp3")}; - $silence -= (1152 / 44100); + $chunk .= ${Slim::Web::HTTP::getStaticContent("html/lbrsilence-". int($samplerate/1000) . ".mp3")}; + $silence -= (1152 / $samplerate); } my $len = length($chunk); diff --git a/Slim/Web/HTTP.pm b/Slim/Web/HTTP.pm index 7004ae1c0e1..ba7e6fc38bb 100644 --- a/Slim/Web/HTTP.pm +++ b/Slim/Web/HTTP.pm @@ -2216,7 +2216,7 @@ sub sendStreamingResponse { } else { - $silence = getStaticContent("html/lbrsilence.mp3"); + $silence = getStaticContent("html/lbrsilence-44.mp3"); } my %segment = ( From 77a4841d12eaf5e7a2fa693d672d402ecd016e14 Mon Sep 17 00:00:00 2001 From: Philippe G Date: Sat, 18 Sep 2021 22:23:18 -0700 Subject: [PATCH 3/3] allow no redirection at all in HTTP it's a valid request to disable all redirection but the use of the || operator disallows it --- Slim/Networking/Async/HTTP.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Slim/Networking/Async/HTTP.pm b/Slim/Networking/Async/HTTP.pm index 55ca16d4178..86764db8b87 100644 --- a/Slim/Networking/Async/HTTP.pm +++ b/Slim/Networking/Async/HTTP.pm @@ -186,7 +186,7 @@ sub use_proxy { sub send_request { my ( $self, $args, $redirect ) = @_; - $self->maxRedirect( $args->{maxRedirect} || MAX_REDIR ); + $self->maxRedirect( $args->{maxRedirect} // MAX_REDIR ); $self->response( undef ) unless $redirect; if ( $args->{Timeout} ) {