mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-10-06 00:37:25 +08:00
fix: mp4 download
This commit is contained in:
@@ -249,13 +249,14 @@ func (p *MP4Plugin) download(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
startTimestamp := startTime.Sub(stream.StartTime).Milliseconds()
|
startTimestamp := startTime.Sub(stream.StartTime).Milliseconds()
|
||||||
|
if startTimestamp > 0 {
|
||||||
var startSample *box.Sample
|
var startSample *box.Sample
|
||||||
if startSample, err = demuxer.SeekTime(uint64(startTimestamp)); err != nil {
|
if startSample, err = demuxer.SeekTime(uint64(startTimestamp)); err != nil {
|
||||||
tsOffset = 0
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tsOffset = -int64(startSample.Timestamp)
|
tsOffset = -int64(startSample.Timestamp)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var part *ContentPart
|
var part *ContentPart
|
||||||
for track, sample := range demuxer.RangeSample {
|
for track, sample := range demuxer.RangeSample {
|
||||||
if i == streamCount-1 && int64(sample.Timestamp) > endTime.Sub(stream.StartTime).Milliseconds() {
|
if i == streamCount-1 && int64(sample.Timestamp) > endTime.Sub(stream.StartTime).Milliseconds() {
|
||||||
|
Reference in New Issue
Block a user