diff --git a/demuxer.go b/demuxer.go index 2780b7c..3304bd2 100644 --- a/demuxer.go +++ b/demuxer.go @@ -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++ diff --git a/muxer.go b/muxer.go index f60436a..82a55a9 100644 --- a/muxer.go +++ b/muxer.go @@ -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 } diff --git a/stream.go b/stream.go index 5252423..550b398 100644 --- a/stream.go +++ b/stream.go @@ -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 {