fix video no ctts bug
This commit is contained in:
parent
2364b70034
commit
c7890dcc2e
@ -229,6 +229,7 @@ func (self *Stream) incSampleIndex() (duration int64) {
|
|||||||
fmt.Printf("incSampleIndex sampleIndex=%d sampleOffsetInChunk=%d sampleIndexInChunk=%d chunkGroupIndex=%d chunkIndex=%d\n",
|
fmt.Printf("incSampleIndex sampleIndex=%d sampleOffsetInChunk=%d sampleIndexInChunk=%d chunkGroupIndex=%d chunkIndex=%d\n",
|
||||||
self.sampleIndex, self.sampleOffsetInChunk, self.sampleIndexInChunk, self.chunkGroupIndex, self.chunkIndex)
|
self.sampleIndex, self.sampleOffsetInChunk, self.sampleIndexInChunk, self.chunkGroupIndex, self.chunkIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sampleIndexInChunk++
|
self.sampleIndexInChunk++
|
||||||
if self.sampleIndexInChunk == self.sample.SampleToChunk.Entries[self.chunkGroupIndex].SamplesPerChunk {
|
if self.sampleIndexInChunk == self.sample.SampleToChunk.Entries[self.chunkGroupIndex].SamplesPerChunk {
|
||||||
self.chunkIndex++
|
self.chunkIndex++
|
||||||
|
6
muxer.go
6
muxer.go
@ -91,7 +91,6 @@ func (self *Stream) fillTrackAtom() (err error) {
|
|||||||
SubType: "vide",
|
SubType: "vide",
|
||||||
Name: "Video Media Handler",
|
Name: "Video Media Handler",
|
||||||
}
|
}
|
||||||
self.sample.CompositionOffset = &atom.CompositionOffset{}
|
|
||||||
self.trackAtom.Media.Info.Video = &atom.VideoMediaInfo{
|
self.trackAtom.Media.Info.Video = &atom.VideoMediaInfo{
|
||||||
Flags: 0x000001,
|
Flags: 0x000001,
|
||||||
}
|
}
|
||||||
@ -131,6 +130,11 @@ func (self *Muxer) WriteHeader() (err error) {
|
|||||||
if self.mdatWriter, err = atom.WriteAtomHeader(self.W, "mdat"); err != nil {
|
if self.mdatWriter, err = atom.WriteAtomHeader(self.W, "mdat"); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for _, stream := range self.streams {
|
||||||
|
if stream.Type().IsVideo() {
|
||||||
|
stream.sample.CompositionOffset = &atom.CompositionOffset{}
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ type Stream struct {
|
|||||||
|
|
||||||
sttsEntry *atom.TimeToSampleEntry
|
sttsEntry *atom.TimeToSampleEntry
|
||||||
cttsEntry *atom.CompositionOffsetEntry
|
cttsEntry *atom.CompositionOffsetEntry
|
||||||
writeMdat func([]byte) (int64, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Stream) timeToTs(time float64) int64 {
|
func (self *Stream) timeToTs(time float64) int64 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user