[Slim-Checkins] r10282 - in /trunk/server/Slim/Player: Source.pm
Squeezebox.pm
andy at svn.slimdevices.com
andy at svn.slimdevices.com
Tue Oct 10 18:21:09 PDT 2006
Author: andy
Date: Tue Oct 10 18:21:07 2006
New Revision: 10282
URL: http://svn.slimdevices.com?rev=10282&view=rev
Log:
Change rebuffering threshold to use the same value we use for quickstart. Don't rebuffer for Softsqueeze since it doesn't report fullness the same as hardware players.
Modified:
trunk/server/Slim/Player/Source.pm
trunk/server/Slim/Player/Squeezebox.pm
Modified: trunk/server/Slim/Player/Source.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Source.pm?rev=10282&r1=10281&r2=10282&view=diff
==============================================================================
--- trunk/server/Slim/Player/Source.pm (original)
+++ trunk/server/Slim/Player/Source.pm Tue Oct 10 18:21:07 2006
@@ -622,14 +622,25 @@
return;
}
- # If a stream falls to below 1% buffer fullness and we
- # have played at least 10 seconds, rebuffer the stream
- my $fullness = int( Slim::Networking::Slimproto::fullness($client) / $client->bufferSize() * 100);
-
+ # Softsqueeze doesn't report buffer fullness the same as hardware
+ if ( $client->isa('Slim::Player::SoftSqueeze') ) {
+ return;
+ }
+
+ my $fullness = $client->bufferFullness();
my $songTime = songTime($client);
- if ( $fullness <= 1 && $songTime > 10 ) {
- $::d_source && msg("Buffer fullness dropped to $fullness%, pausing to rebuffer\n");
+ # We want the buffer to contain the same amount of data required by quickstart
+ my $threshold = 20 * 1024;
+
+ # If we know the bitrate of the stream, we instead buffer a certain number of seconds of audio
+ if ( my $bitrate = Slim::Music::Info::getBitrate($url) ) {
+ my $bufferSecs = Slim::Utils::Prefs::get('bufferSecs') || 3;
+ $threshold = int($bitrate / 8) * $bufferSecs;
+ }
+
+ if ( $fullness < $threshold && $songTime > 10 ) {
+ $::d_source && msg("Buffered audio dropped to $fullness bytes, pausing to rebuffer\n");
$client->pause();
@@ -638,7 +649,7 @@
$client,
Time::HiRes::time() + 0.125,
\&Slim::Player::Squeezebox::quickstart,
- 5, # signals quickstart what percentage to rebuffer to
+ 1, # signals quickstart we are in rebuffering mode
);
}
}
Modified: trunk/server/Slim/Player/Squeezebox.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Squeezebox.pm?rev=10282&r1=10281&r2=10282&view=diff
==============================================================================
--- trunk/server/Slim/Player/Squeezebox.pm (original)
+++ trunk/server/Slim/Player/Squeezebox.pm Tue Oct 10 18:21:07 2006
@@ -240,14 +240,7 @@
$threshold = int($bitrate / 8) * $bufferSecs;
}
- if ( $rebuffer ) {
- # Change the threshold to a precentage of buffer size
- $threshold = int( $client->bufferSize() * ( $rebuffer / 100 ) );
- $::d_source && msg("Quickstart: Rebuffering to $rebuffer%... $fullness / $threshold\n");
- }
- else {
- $::d_source && msg("Quickstart: Buffering... $fullness / $threshold\n");
- }
+ $::d_source && msg("Quickstart: Buffering... $fullness / $threshold\n");
# Resume if we've hit the threshold, unless synced (sync unpauses all clients together)
if ( $fullness >= $threshold && !Slim::Player::Sync::isSynced($client) ) {
More information about the checkins
mailing list