mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Fix connection_status check on stream
This commit is contained in:
parent
b7fb651c07
commit
050f045c0d
1 changed files with 11 additions and 13 deletions
|
@ -616,17 +616,15 @@ $bytes_streamed = 0;
|
||||||
|
|
||||||
// Actually do the streaming
|
// Actually do the streaming
|
||||||
$buf_all = '';
|
$buf_all = '';
|
||||||
do {
|
$r_arr = array($fp);
|
||||||
$read_size = $transcode
|
$w_arr = $e_arr = null;
|
||||||
? 2048
|
$status = stream_select($r_arr, $w_arr, $e_arr, 2);
|
||||||
: min(2048, $stream_size - $bytes_streamed);
|
if ($status === false) {
|
||||||
$r_arr = array($fp);
|
debug_event('play', 'stream_select failed.', 1);
|
||||||
$w_arr = $e_arr = null;
|
} elseif ($status > 0) {
|
||||||
$status = stream_select($r_arr, $w_arr, $e_arr, 2);
|
do {
|
||||||
if ($status === false) {
|
$read_size = $transcode ? 2048 : min(2048, $stream_size - $bytes_streamed);
|
||||||
break; // Error
|
if ($buf = fread($fp, $read_size)) {
|
||||||
} elseif ($status > 0) {
|
|
||||||
while ($buf = fread($fp, $read_size)) {
|
|
||||||
if ($send_all_in_once) {
|
if ($send_all_in_once) {
|
||||||
$buf_all .= $buf;
|
$buf_all .= $buf;
|
||||||
} else {
|
} else {
|
||||||
|
@ -642,8 +640,8 @@ do {
|
||||||
}
|
}
|
||||||
$bytes_streamed += strlen($buf);
|
$bytes_streamed += strlen($buf);
|
||||||
}
|
}
|
||||||
}
|
} while (!feof($fp) && (connection_status() == 0) && ($transcode || $bytes_streamed < $stream_size));
|
||||||
} while (!feof($fp) && (connection_status() == 0) && ($transcode || $bytes_streamed < $stream_size));
|
}
|
||||||
|
|
||||||
if ($send_all_in_once && connection_status() == 0) {
|
if ($send_all_in_once && connection_status() == 0) {
|
||||||
header("Content-Length: " . strlen($buf_all));
|
header("Content-Length: " . strlen($buf_all));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue