Skip to content

Commit

Permalink
Merge pull request #656 from philippe44/8.2.1-misc
Browse files Browse the repository at this point in the history
Correct start time for streams with range offset
  • Loading branch information
mherger committed Sep 3, 2021
2 parents e8392d8 + 4e9ae3a commit 4a4de82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Slim/Player/Protocols/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,9 @@ sub parseDirectHeaders {
{
$startOffset = $seekdata->{sourceStreamOffset};
}
else {
$startOffset -= $song->currentTrack->audio_offset;
}

my $streamLength = $length;
$streamLength -= $startOffset if $startOffset;
Expand Down
8 changes: 7 additions & 1 deletion Slim/Utils/Scanner/Remote.pm
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,14 @@ sub parseMp4Header {
return 0;
}

# some mp4 file have wrong mdat length
if ($info->{audio_offset} + $info->{audio_size} > $http->response->content_length) {
$log->warn("inconsistent audio offset/size $info->{audio_offset}+$info->{audio_size}and content_length ", $http->response->content_length);
$track->audio_size($http->response->content_length - $info->{audio_offset});
} else {
$track->audio_size($info->{audio_size});
}
$track->audio_offset($info->{audio_offset});
$track->audio_size($info->{audio_size});
$track->samplerate($samplerate);
$track->samplesize($samplesize);
$track->channels($channels);
Expand Down

0 comments on commit 4a4de82

Please sign in to comment.