forked from External/mediamtx
playback: improve precision when splitting fMP4 parts (#3250)
This commit is contained in:
parent
95f1f79b35
commit
3a968118db
2 changed files with 24 additions and 2 deletions
|
|
@ -94,7 +94,7 @@ func (w *muxerFMP4) writeSample(
|
|||
|
||||
partDurationMP4 := durationGoToMp4(partDuration, w.curTrack.timeScale)
|
||||
|
||||
if (w.curTrack.lastDTS - w.curTrack.firstDTS) > partDurationMP4 {
|
||||
if (w.curTrack.lastDTS - w.curTrack.firstDTS) >= partDurationMP4 {
|
||||
err := w.innerFlush(false)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -305,6 +305,17 @@ func TestOnGet(t *testing.T) {
|
|||
IsNonSyncSample: true,
|
||||
Payload: []byte{5, 6},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
SequenceNumber: 1,
|
||||
Tracks: []*fmp4.PartTrack{
|
||||
{
|
||||
ID: 1,
|
||||
BaseTime: 90000,
|
||||
Samples: []*fmp4.PartSample{
|
||||
{
|
||||
Duration: 90000,
|
||||
Payload: []byte{7, 8},
|
||||
|
|
@ -314,7 +325,7 @@ func TestOnGet(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
SequenceNumber: 1,
|
||||
SequenceNumber: 2,
|
||||
Tracks: []*fmp4.PartTrack{
|
||||
{
|
||||
ID: 1,
|
||||
|
|
@ -660,6 +671,17 @@ func TestOnGetNTPCompensation(t *testing.T) {
|
|||
Duration: 90000,
|
||||
Payload: []byte{9, 10},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
SequenceNumber: 2,
|
||||
Tracks: []*fmp4.PartTrack{
|
||||
{
|
||||
ID: 1,
|
||||
BaseTime: 225000,
|
||||
Samples: []*fmp4.PartSample{
|
||||
{
|
||||
Duration: 90000,
|
||||
Payload: []byte{11, 12},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue