Buggy code:
public class StreamController implements Controller { private static final Logger LOG = Logger . getLogger ( StreamController . class ) ; private StatusService statusService ; private PlayerService playerService ; private PlaylistService playlistService ; private SecurityService securityService ; private SettingsService settingsService ; private TranscodingService transcodingService ; private AudioScrobblerService audioScrobblerService ; private MediaFileService mediaFileService ; private SearchService searchService ; public ModelAndView handleRequest ( HttpServletRequest request , HttpServletResponse response ) throws Exception { TransferStatus status = null ; PlayQueueInputStream in = null ; Player player = playerService . getPlayer ( request , response , false , true ) ; User user = securityService . getUserByName ( player . getUsername ( ) ) ; try { if ( ! ( user . isStreamRole ( ) ) ) { response . sendError ( SC_FORBIDDEN , ( "Streaming<seq2seq4repair_space>is<seq2seq4repair_space>forbidden<seq2seq4repair_space>for<seq2seq4repair_space>user<seq2seq4repair_space>" + ( user . getUsername ( ) ) ) ) ; return null ; } Integer playlistId = ServletRequestUtils . getIntParameter ( request , "playlist" ) ; boolean isPodcast = playlistId != null ; if ( isPodcast ) { PlayQueue playQueue = new PlayQueue ( ) ; playQueue . addFiles ( false , playlistService . getFilesInPlaylist ( playlistId ) ) ; player . setPlayQueue ( playQueue ) ; Util . setContentLength ( response , playQueue . length ( ) ) ; StreamController . LOG . info ( ( "Incoming<seq2seq4repair_space>Podcast<seq2seq4repair_space>request<seq2seq4repair_space>for<seq2seq4repair_space>playlist<seq2seq4repair_space>" + playlistId ) ) ; } response . addHeader ( "Access-Control-Allow-Origin" , "*" ) ; String contentType = StringUtil . getMimeType ( request . getParameter ( "suffix" ) ) ; response . setContentType ( contentType ) ; String preferredTargetFormat = request . getParameter ( "format" ) ; Integer maxBitRate = ServletRequestUtils . getIntParameter ( request , "maxBitRate" ) ; if ( Integer . valueOf ( 0 ) . equals ( maxBitRate ) ) { maxBitRate = null ; } VideoTranscodingSettings videoTranscodingSettings = null ; MediaFile file = getSingleFile ( request ) ; boolean isSingleFile = file != null ; HttpRange range = null ; if ( isSingleFile ) { if ( ! ( securityService . isFolderAccessAllowed ( file , user . getUsername ( ) ) ) ) { response . sendError ( SC_FORBIDDEN , ( ( ( "Access<seq2seq4repair_space>to<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getId ( ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>forbidden<seq2seq4repair_space>for<seq2seq4repair_space>user<seq2seq4repair_space>" ) + ( user . getUsername ( ) ) ) ) ; return null ; } PlayQueue playQueue = new PlayQueue ( ) ; playQueue . addFiles ( true , file ) ; player . setPlayQueue ( playQueue ) ; if ( ! ( file . isVideo ( ) ) ) { response . setIntHeader ( "ETag" , file . getId ( ) ) ; response . setHeader ( "Accept-Ranges" , "bytes" ) ; } TranscodingService . Parameters parameters = transcodingService . getParameters ( file , player , maxBitRate , preferredTargetFormat , null ) ; long fileLength = getFileLength ( parameters ) ; boolean isConversion = ( parameters . isDownsample ( ) ) || ( parameters . isTranscode ( ) ) ; boolean estimateContentLength = ServletRequestUtils . getBooleanParameter ( request , "estimateContentLength" , false ) ; boolean isHls = ServletRequestUtils . getBooleanParameter ( request , "hls" , false ) ; range = getRange ( request , file ) ; <START_BUG> if ( range != null ) { <END_BUG> StreamController . LOG . info ( ( "Got<seq2seq4repair_space>HTTP<seq2seq4repair_space>range:<seq2seq4repair_space>" + range ) ) ; response . setStatus ( SC_PARTIAL_CONTENT ) ; Util . setContentLength ( response , ( range . isClosed ( ) ? range . size ( ) : fileLength - ( range . getFirstBytePos ( ) ) ) ) ; long lastBytePos = ( ( range . getLastBytePos ( ) ) != null ) ? range . getLastBytePos ( ) : fileLength - 1 ; response . setHeader ( "Content-Range" , ( ( ( ( ( "bytes<seq2seq4repair_space>" + ( range . getFirstBytePos ( ) ) ) + "-" ) + lastBytePos ) + "//" ) + fileLength ) ) ; } else if ( ( ! isHls ) && ( ( ! isConversion ) || estimateContentLength ) ) { Util . setContentLength ( response , fileLength ) ; } if ( isHls ) { response . setContentType ( StringUtil . getMimeType ( "ts" ) ) ; } else { String transcodedSuffix = transcodingService . getSuffix ( player , file , preferredTargetFormat ) ; boolean sonos = SUBSONIC_CLIENT_ID . equals ( player . getClientId ( ) ) ; response . setContentType ( StringUtil . getMimeType ( transcodedSuffix , sonos ) ) ; setContentDuration ( response , file ) ; } if ( ( file . isVideo ( ) ) || isHls ) { videoTranscodingSettings = createVideoTranscodingSettings ( file , request ) ; } } if ( request . getMethod ( ) . equals ( "HEAD" ) ) { return null ; } if ( ( ! isPodcast ) && ( ! isSingleFile ) ) { for ( TransferStatus streamStatus : statusService . getStreamStatusesForPlayer ( player ) ) { if ( streamStatus . isActive ( ) ) { streamStatus . terminate ( ) ; } } } status = statusService . createStreamStatus ( player ) ; in = new PlayQueueInputStream ( player , status , maxBitRate , preferredTargetFormat , videoTranscodingSettings , transcodingService , audioScrobblerService , mediaFileService , searchService ) ; OutputStream out = RangeOutputStream . wrap ( response . getOutputStream ( ) , range ) ; boolean isShoutCastRequested = "1" . equals ( request . getHeader ( "icy-metadata" ) ) ; if ( isShoutCastRequested && ( ! isSingleFile ) ) { response . setHeader ( "icy-metaint" , ( "" + ( ShoutCastOutputStream . META_DATA_INTERVAL ) ) ) ; response . setHeader ( "icy-notice1" , "This<seq2seq4repair_space>stream<seq2seq4repair_space>is<seq2seq4repair_space>served<seq2seq4repair_space>using<seq2seq4repair_space>Subsonic" ) ; response . setHeader ( "icy-notice2" , "Subsonic<seq2seq4repair_space>-<seq2seq4repair_space>Free<seq2seq4repair_space>media<seq2seq4repair_space>streamer<seq2seq4repair_space>-<seq2seq4repair_space>subsonic.org" ) ; response . setHeader ( "icy-name" , "Subsonic" ) ; response . setHeader ( "icy-genre" , "Mixed" ) ; response . setHeader ( "icy-url" , "http:////subsonic.org//" ) ; out = new ShoutCastOutputStream ( out , player . getPlayQueue ( ) , settingsService ) ; } final int BUFFER_SIZE = 2048 ;

Fix:
if ( ( range != null ) && ( ! ( file . isVideo ( ) ) ) ) {