I think I now have identified the circumstances of the problem and it
changes with the OS *and* the player. This is some sort of failure of
the SSL layer of the RP servers (openSSL 1.0.2g) when a stream has
frequent pauses (around 5s). Such pauses occur if the player has a large
buffer and some high/low watermark (my bridges) and the Perl SSL OS
layer is "fast" enough. Pattern is burst download and then a pause of
5sec. When these pauses do not happen (smooth packet download at least
every second), then the issue does not happen. For example, with my
Boom, there is no pause, so it's fine.

A UPnPBridge for example exacerbates the problem, but on my Windows
platform it almost never happens because my Perl SSL layer is very slow
so there is a constant flow of packet (except for very long blocks where
at some point, the stream catches up and saturates the buffer).

Here is a small Perl app that shows the problem 90% of times. On my Pi,
with a SLEEP of 1, it almost never happens, with a SLEEP of 5, it
happens every time. Does not give me a solution, but at least helps
figuring out what's happening.

If you want to try something, you can add this to the ProtocolHandler.pm
of RadioParadise, and erase the existing "new" subroutine. Please
understand this is not *at all* a proper patch (by any mean, this is
very ugly and will use 100% of CPU) but that would help
illustrating/confirming the problem.


Code:
--------------------
    
  sub sysread {
        my $self = $_[0];
        my $chunkSize = $_[2];
        my $now = time();
        my $bitrate = ${*$self}{song}->bitrate || 850_000;
  
        if (!($now - ${*$self}{start}) || ${*$self}{bytes} / ($now - 
${*$self}{start}) < 1.10*$bitrate/8) {
                my $readLength = $self->SUPER::sysread($_[1], $chunkSize);
                ${*$self}{bytes} += $readLength;
                return $readLength;
        } else {
                $! = EWOULDBLOCK;
                return undef;
        }
  }     
  
  # To support remote streaming (synced players, slimp3/SB1), we need to 
subclass Protocols::HTTP
  sub new {
        my $class  = shift;
        my $args   = shift;
  
        my $client = $args->{client};
  
        my $song      = $args->{'song'};
        my $streamUrl = $song->streamUrl() || return;
  
        my ($quality, $format) = _getStreamParams( $args->{url} );
  
        my $sock = $class->SUPER::new( {
                url     => $streamUrl,
                song    => $args->{'song'},
                client  => $client,
                bitrate => $quality < 4 ? $AAC_BITRATE{$quality} * 1024 : 
850_000,
        } ) || return;
  
        ${*$sock}{contentType} = 'audio/' . $format;
        
        ${*$sock}{start} = time();
        ${*$sock}{bytes} = 0;
  
        return $sock;
  }
  }
  
--------------------


+-------------------------------------------------------------------+
|Filename: lwp-s.pl                                                 |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=27221|
+-------------------------------------------------------------------+


LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos
PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000,
ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi
B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010,
AppleTV 4, Airport Express, GGMM E5
------------------------------------------------------------------------
philippe_44's Profile: http://forums.slimdevices.com/member.php?userid=17261
View this thread: http://forums.slimdevices.com/showthread.php?t=108189

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to