summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/class/stream.class.php8
-rw-r--r--play/index.php15
2 files changed, 6 insertions, 17 deletions
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 72cafa33..e274e78a 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -609,12 +609,10 @@ class Stream {
$message = "Start Downsample: $downsample_command";
debug_event('downsample',$message,'3');
- $fp = @popen($downsample_command, 'rb');
+ $fp = popen($downsample_command, 'rb');
- /* We need more than just the handle here */
- $return_array['handle'] = $fp;
-
- return ($return_array);
+ // Return our new handle
+ return ($fp);
} // start_downsample
diff --git a/play/index.php b/play/index.php
index 3d700678..72bd18e0 100644
--- a/play/index.php
+++ b/play/index.php
@@ -250,10 +250,7 @@ if (Config::get('access_control') AND Config::get('downsample_remote')) {
// If they are downsampling, or if the song is not a native stream or it's non-local
if (($GLOBALS['user']->prefs['transcode'] == 'always' || !$song->native_stream() || $not_local) && $GLOBALS['user']->prefs['transcode'] != 'never') {
debug_event('downsample','Starting Downsample...','5');
- $results = Stream::start_downsample($song,$lastid,$song_name);
- $fp = $results['handle'];
- $song->size = $results['size'];
-
+ $fp = Stream::start_downsample($song,$lastid,$song_name);
} // end if downsampling
else {
// Send file, possible at a byte offset
@@ -265,12 +262,6 @@ else {
}
} // else not downsampling
-// We need to check to see if they are rate limited
-$chunk_size = '2084';
-
-// Attempted fix, pimp up the size a bit
-$song->size = $song->size;
-
// Put this song in the now_playing table
insert_now_playing($song->id,$uid,$song->time,$sid);
@@ -300,9 +291,9 @@ $minBytesStreamed = $song->size / 2;
// Actually do the streaming
do {
- $buf = fread($fp, $chunk_size);
+ $buf = fread($fp, 2048);
print($buf);
- $bytesStreamed += $chunk_size;
+ $bytesStreamed += 2048;
} while (!feof($fp) && (connection_status() == 0));
// Make sure that a good chunk of the song has been played