--- HTTP.pm.dist 2009-10-18 11:43:03.000000000 +0100 +++ HTTP.pm 2009-10-18 11:45:20.000000000 +0100 @@ -543,6 +543,35 @@ $sendMetaData{$httpClient} = 1; } + #Reciva based internet radios pretend to be linux real player, + #but metadata causes audio blips. In tests RealPlayer also only + #seems to do anything with initial metadata in HTTP headers, + #not in audio. So disable anything other than initial HTTP + #headers metadata to prevent audio corruption on Reciva + #radios. + + #To try to mitigate any adverse affect on versions of + #RealPlayer which may support MetaData try to detect Reciva + #Internet Radios by the absence of an Accept-Encoding: gzip + #header which is present on both RealPlayer 10 for Linux + #and RealPlayer SP v12 on Win32, and also only trigger + #when headers indicate that this is a Linux client + + if($sendMetaData{$httpClient} + && defined($request->header('User-Agent')) + && $request->header('User-Agent') =~ m{^\s*RMA/1\.0} + && defined($request->header('ClientID')) + && $request->header('ClientID') =~ m{^\s*Linux} + && (!defined($request->header('Accept-Encoding')) + || $request->header('Accept-Encoding') !~ /gzip/i )) + { + #Empty string will resolve to false when used as a + #boolean, but can be distinguised from 0 using a + #string comparison. Use empty string to indicate that + #HTTP headers should be sent, but no in-stream metadata. + $sendMetaData{$httpClient} = ''; + } + # parse out URI my $query = ($request->method() eq "POST") ? $request->content() : $uri->query(); @@ -1128,6 +1157,17 @@ $response->header("icy-metaint" => METADATAINTERVAL); $response->header("icy-name" => string('WELCOME_TO_SQUEEZEBOX_SERVER')); } + #Use a string comparison operator to pick up on empty + #string value which is used to indicate that HTTP + #headers should be sent, but no in-band metadata + elsif($sendMetaData{$httpClient} eq '') + { + #Even though we won't be regularly sending + #metadata real player won't pick up the name + #without an interval, so set it to zero + $response->header("icy-metaint" => 0); + $response->header("icy-name" => string('SQUEEZEBOX_SERVER')); + } main::INFOLOG && $log->is_info && $log->info("Disabling keep-alive for stream.mp3"); delete $keepAlives{$httpClient};