Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MP3 audio startup silence should be set according to track sample rate #644

Open
wants to merge 3 commits into
base: public/8.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added HTML/EN/html/lbrsilence-32.mp3
Binary file not shown.
File renamed without changes.
Binary file added HTML/EN/html/lbrsilence-48.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion Slim/Networking/Async/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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} ) {
Expand Down
7 changes: 4 additions & 3 deletions Slim/Player/Source.pm
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ sub _readNextChunk {
my $chunk = '';

my $endofsong = undef;
my $samplerate = $client->streamingSong()->currentTrack->samplerate();

if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3') {
if ($client->streamBytes() == 0 && $client->streamformat() eq 'mp3' && $samplerate >= 32000) {

my $silence = 0;
# use the maximum silence prelude for the whole sync group...
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Slim/Web/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ sub sendStreamingResponse {

} else {

$silence = getStaticContent("html/lbrsilence.mp3");
$silence = getStaticContent("html/lbrsilence-44.mp3");
}

my %segment = (
Expand Down