summaryrefslogtreecommitdiffstats
path: root/lib/stream.lib.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-02 02:48:17 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-02 02:48:17 +0000
commitdac2f19d709403be00af5ded76030f9edb44b9c1 (patch)
tree72307b6ac2cdab9b7f21b43d26f8e4e06abdfcc3 /lib/stream.lib.php
parent2caa80fcfd81d6cf79e81ae12fa7c34efb77341a (diff)
downloadampache-dac2f19d709403be00af5ded76030f9edb44b9c1.tar.gz
ampache-dac2f19d709403be00af5ded76030f9edb44b9c1.tar.bz2
ampache-dac2f19d709403be00af5ded76030f9edb44b9c1.zip
fixed some more stupid mistakes in the downsample code and removed some debug code
Diffstat (limited to 'lib/stream.lib.php')
-rw-r--r--lib/stream.lib.php18
1 files changed, 9 insertions, 9 deletions
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');