Author: ayoung
Date: Thu Nov 10 02:24:13 2011
New Revision: 33681
URL: http://svn.slimdevices.com/slim?rev=33681&view=rev
Log:
bug 17692: Stream proxy capability for SqueezePlay
Remove the mechanism for tracking packet latency to players because it is too unreliable.
Better just to assume a fixed latency that is the same for all players.
Can use preference if really necessary.
Modified:
7.7/trunk/server/Slim/Networking/Slimproto.pm
7.7/trunk/server/Slim/Player/SqueezeSlave.pm
7.7/trunk/server/Slim/Player/Squeezebox.pm
7.7/trunk/server/Slim/Player/Squeezebox2.pm
Modified: 7.7/trunk/server/Slim/Networking/Slimproto.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Networking/Slimproto.pm?rev=33681&r1=33680&r2=33681&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Networking/Slimproto.pm (original)
+++ 7.7/trunk/server/Slim/Networking/Slimproto.pm Thu Nov 10 02:24:13 2011
@@ -28,8 +28,6 @@
}
use constant SLIMPROTO_PORT => 3483;
-use constant LATENCY_LIST_MAX => 10;
-use constant LATENCY_LIST_MIN => 6;
our @deviceids = (undef, undef, 'squeezebox', 'softsqueeze','squeezebox2','transporter', 'softsqueeze3', 'receiver', 'squeezeslave', 'controller', 'boom', 'softboom', 'squeezeplay');
my $log = logger('network.protocol.slimproto');
@@ -64,8 +62,6 @@
our %sock2client; # reference to client for each sonnected sock
our %heartbeat; # the last time we heard from a client
our %status;
-our %latencyList; # last few latencies
-our %latency; # current published latency
our %callbacksRAWI;
@@ -233,7 +229,7 @@
next;
}
- # Always ask for status requests so we can use the result for latency tracking
+ # Always ask for a status request so we can initialize the epoch
$client->requestStatus();
}
@@ -263,8 +259,6 @@
}
delete $heartbeat{ $client->id };
- delete $latency{ $client };
- delete $latencyList{ $client };
$client->tcpsock(undef);
@@ -769,24 +763,7 @@
# 53 = future firmware (correct length)
$stat->{'error_code'} = 0;
}
-
- # Track latency if we have a server timestamp
- if ( $stat->{'server_timestamp'} ) {
- my $latency = (int($now * 1000 % 0xffffffff) - $stat->{'server_timestamp'}) / 2;
-
- push (@{$latencyList{$client}}, $latency) if ($latency >= 0 && $latency < 1000);
- shift(@{$latencyList{$client}}) if (@{$latencyList{$client}} > LATENCY_LIST_MAX);
-
- $latency{$client} = Slim::Utils::Misc::min($latencyList{$client}) if (@{$latencyList{$client}} >= LATENCY_LIST_MIN);
-
- if ( main::DEBUGLOG && $log->is_debug ) {
- $log->debug(
- $client->id() . " latency=$latency{$client}, from ("
- . join(', ', @{$latencyList{$client}}) . ')'
- );
- }
- }
-
+
$client->trackJiffiesEpoch($stat->{'jiffies'}, $now);
$stat->{'bytes_received'} = $stat->{'bytes_received_H'} * 2**32 + $stat->{'bytes_received_L'};
@@ -899,10 +876,6 @@
=cut
}
-sub getLatency {
- return $latency{shift} || 0;
-}
-
sub getPlayPointData {
my $client = shift;
return ($status{$client}->{'jiffies'}, $status{$client}->{'elapsed_milliseconds'}, $status{$client}->{'elapsed_seconds'});
@@ -1278,8 +1251,6 @@
}
$sock2client{$s} = $client;
-
- $latencyList{$client} = [];
# Bug 10634 - reset the jiffiesEpoch so that any drift during a long disconnection is reset immediately
$client->jiffiesEpoch(undef);
Modified: 7.7/trunk/server/Slim/Player/SqueezeSlave.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Player/SqueezeSlave.pm?rev=33681&r1=33680&r2=33681&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Player/SqueezeSlave.pm (original)
+++ 7.7/trunk/server/Slim/Player/SqueezeSlave.pm Thu Nov 10 02:24:13 2011
@@ -235,16 +235,6 @@
my $rate = $pcm_sample_rates{$track->samplerate()};
return defined $rate ? $rate : '3';
-}
-
-sub packetLatency {
- my $client = shift;
-
- return (
- Slim::Networking::Slimproto::getLatency($client) / 1000
- ||
- $client->SUPER::packetLatency()
- );
}
sub statHandler {
Modified: 7.7/trunk/server/Slim/Player/Squeezebox.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Player/Squeezebox.pm?rev=33681&r1=33680&r2=33681&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Player/Squeezebox.pm (original)
+++ 7.7/trunk/server/Slim/Player/Squeezebox.pm Thu Nov 10 02:24:13 2011
@@ -1054,7 +1054,7 @@
$replayGain = $interval;
}
elsif ($command eq 't') {
- $replayGain = int(Time::HiRes::time() * 1000 % 0xffffffff);
+ $replayGain = 0; # stop using this method to track latency - it is too unreliable
}
else {
$replayGain = $client->canDoReplayGain($params->{replay_gain});
Modified: 7.7/trunk/server/Slim/Player/Squeezebox2.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Player/Squeezebox2.pm?rev=33681&r1=33680&r2=33681&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Player/Squeezebox2.pm (original)
+++ 7.7/trunk/server/Slim/Player/Squeezebox2.pm Thu Nov 10 02:24:13 2011
@@ -1095,12 +1095,4 @@
return 1;
}
-sub packetLatency {
- my $client = shift;
- my $latency = Slim::Networking::Slimproto::getLatency($client);
- return (
- defined $latency ? $latency / 1000 : $client->SUPER::packetLatency()
- );
-}
-
1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.