From dac2f19d709403be00af5ded76030f9edb44b9c1 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 2 Jan 2006 02:48:17 +0000 Subject: fixed some more stupid mistakes in the downsample code and removed some debug code --- lib/stream.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/stream.lib.php') diff --git a/lib/stream.lib.php b/lib/stream.lib.php index 1415a6fe..89ca52b4 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -207,18 +207,18 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) { $sample_rate = $user_sample_rate; } - + /* Validate the bitrate */ + $sample_rate = validate_bitrate($sample_rate); + /* Never Upsample a song */ if (($sample_rate*1000) > $song->bitrate) { $sample_rate = $song->bitrate/1000; $sample_ratio = '1'; } - - /* Validate the bitrate */ - $sample_rate = validate_bitrate($sample_rate); - - /* Set the Sample Ratio */ - $sample_ratio = $sample_rate/($song->bitrate/1000); + else { + /* Set the Sample Ratio */ + $sample_ratio = $sample_rate/($song->bitrate/1000); + } header("Content-Length: " . $sample_ratio*$song->size); $browser->downloadHeaders($song_name, $song->mime, false,$sample_ratio*$song->size); @@ -244,10 +244,10 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) { $downsample_command = str_replace("%SAMPLE%",$sample_rate,$downsample_command); // If we are debugging log this event - //if (conf('debug')) { + if (conf('debug')) { $message = "Start Downsample: $downsample_command"; log_event($GLOBALS['user']->username,' downsample ',$message); - //} // if debug + } // if debug $fp = @popen($downsample_command, 'r'); -- cgit