danco wrote: 
> My setting is at the maximum available (I think it is 30), which usually
> works.
> 
> I have wondered if it is possible to go into the code and change it to a
> larger figure, such as 60. I would rather wait for a minute than have to
> restart the whole program, which is what happens at times currently.
> 
> I know that some bits of code are easy to change, for instance I have
> changed the BBC iPlayer Extras default.opml to put the National Radio
> Schedules at the top, but of course other items of code won't allow
> simple changes.

It is one of the areas I have been playing around. The LMS AsyncHTTP
routine used to "get" an URL has two parameters - expires and timeout.
Timeout is the timeout for a HTTP get - I'm not too sure of expoires but
I think it is the life of a DNS entry.   If not set then defaults are
used.   Changing the timelimits per HTTP GET is quite easy and is done
in the HLS.pm file.  The following are the two routines I have changed.
Note they have added instrumentation to monitor fetch times - you only
need to add the cache, timeout and expires to your HLS.pm to play
around.

The fetching of the "pls" which tell LMS which 6 secs segments to fetch

Code:
--------------------
    
  sub _fetchPL {
        my $self = shift;
        my $url  = shift;
        my $start= shift || 0;
  
        $log->debug("fetch playlist: $url start: $start");
  
        ${*$self}{'_pl_refetch'} = undef;       
  
        Slim::Networking::SimpleAsyncHTTP->new(
                \&_parsePL, 
                sub { 
                        my $http = shift;
                        my $fetchtime = int((Time::HiRes::time() - 
$http->params('fetchtime'))*1000);                   
                        $log->warn("Error: fetch time $fetchtime fetching  
$url");
                        $self->close; 
                }, 
  [color=red]           { obj => $self, url => $url, start => $start, cache => 
0, expires =>HLS_TTL_EXPIRES, timeout=>HLS_PLS_TIMEOUT , fetchtime => 
Time::HiRes::time() }[/color=red]
        )->get($url);
  }
  
--------------------



Code:
--------------------
    
  ub _fetchChunk {
        my $self  = shift;
        my $chunk = shift;
  
        if (my $url = $chunk->{'url'}) {
                $log->debug("fetching [$chunk->{chunknum}]: $url");
                $chunk->{'fetching'} = 1;
                $chunk->{'requesttime'} = Time::HiRes::time();          
                Slim::Networking::SimpleAsyncHTTP->new(
                        sub {
                                $log->is_debug && $log->debug("got 
[$chunk->{chunknum}] size " . length($_[0]->content));
                                my $fetchtime = int((Time::HiRes::time() - 
$chunk->{'requesttime'}) *1000);
                                $log->error("HLS chunk fetch time $fetchtime 
ms") if ($fetchtime > 300) ;                               
                                delete $chunk->{'fetching'}; 
                                delete $chunk->{'requesttime'};
                                $chunk->{'chunkref'} = $_[0]->contentRef;
                        },
                        sub { 
                                my $fetchtime = int((Time::HiRes::time() - 
$chunk->{'requesttime'}) *1000);
                                $log->warn("error fetching [$chunk->{chunknum}] 
fetch time $fetchtime  $url");
                                delete $chunk->{'fetching'};
                                delete $chunk->{'requesttime'};
                                
                        }, 
                { cache =>1, expires =>HLS_TTL_EXPIRES, 
timeout=>HLS_SEGMENT_TIMEOUT }
                )->get($url);
        }
  }
  [/code[


------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=103435

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to