Skip to content

Commit

Permalink
Merge pull request #585 from philippe44/misc
Browse files Browse the repository at this point in the history
mp4 parser for trailing header must keep original request fields
  • Loading branch information
mherger committed Apr 14, 2021
2 parents 35a0bdb + ca8d21a commit af78445
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Slim/Utils/Scanner/Remote.pm
Original file line number Diff line number Diff line change
Expand Up @@ -762,21 +762,22 @@ sub parseMp4Header {
return 1;
}
else {
# please restart from offset set by $info
# please restart from offset set by $info, keep current request's custom fields...
my $query = Slim::Networking::Async::HTTP->new;
$http->disconnect;
$http->request->header('Range' => "bytes=$info-");

# re-calculate header all the time (i.e. can't go direct at all)
$args->{initial_block_type} = Slim::Schema::RemoteTrack::INITIAL_BLOCK_ALWAYS;

main::INFOLOG && $log->is_info && $log->info("'mdat' reached before 'moov' at ", length($args->{_scanbuf}), " => seeking with $args->{_range}");

$query->send_request( {
request => HTTP::Request->new( GET => $url, [ 'Range' => "bytes=$info-" ] ),
request => $http->request,
onStream => \&parseMp4Header,
onError => sub {
my ($self, $error) = @_;
$log->warn( "could not find MP4 header $error" );
$log->error( "could not find MP4 header $error" );
$args->{cb}->( $track, undef, @{$args->{pt} || []} );
},
passthrough => [ $track, $args, $url ],
Expand Down

0 comments on commit af78445

Please sign in to comment.