fix video no ctts bug

This commit is contained in:
nareix 2016-04-21 21:17:51 +08:00
parent 2364b70034
commit c7890dcc2e
3 changed files with 6 additions and 2 deletions

View File

@ -229,6 +229,7 @@ func (self *Stream) incSampleIndex() (duration int64) {
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.sampleIndexInChunk++
if self.sampleIndexInChunk == self.sample.SampleToChunk.Entries[self.chunkGroupIndex].SamplesPerChunk {
self.chunkIndex++

View File

@ -91,7 +91,6 @@ func (self *Stream) fillTrackAtom() (err error) {
SubType: "vide",
Name: "Video Media Handler",
}
self.sample.CompositionOffset = &atom.CompositionOffset{}
self.trackAtom.Media.Info.Video = &atom.VideoMediaInfo{
Flags: 0x000001,
}
@ -131,6 +130,11 @@ func (self *Muxer) WriteHeader() (err error) {
if self.mdatWriter, err = atom.WriteAtomHeader(self.W, "mdat"); err != nil {
return
}
for _, stream := range self.streams {
if stream.Type().IsVideo() {
stream.sample.CompositionOffset = &atom.CompositionOffset{}
}
}
return
}

View File

@ -37,7 +37,6 @@ type Stream struct {
sttsEntry *atom.TimeToSampleEntry
cttsEntry *atom.CompositionOffsetEntry
writeMdat func([]byte) (int64, error)
}
func (self *Stream) timeToTs(time float64) int64 {