summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/stream.lib.php18
2 files changed, 10 insertions, 9 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index bd78f752..d0b6d91a 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.3.2-Beta1
+ - Fixed some logic errors in Downsampling code
- Updated Registration code (Thx pb1dft)
- Updated GetId3() Library to v.1.7.5
- Updated SQL file
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');