Browse Source

hls: simplify audio pts generation

pull/591/head
aler9 5 years ago
parent
commit
98bf53a1e8
  1. 8
      internal/hls/muxer.go

8
internal/hls/muxer.go

@ -150,10 +150,8 @@ func (m *Muxer) WriteAAC(pts time.Duration, aus [][]byte) error { @@ -150,10 +150,8 @@ func (m *Muxer) WriteAAC(pts time.Duration, aus [][]byte) error {
pts = pts - m.startPTS + pcrOffset
for i, au := range aus {
auPTS := pts + time.Duration(i)*1000*time.Second/time.Duration(m.aacConf.SampleRate)
err := m.currentSegment.writeAAC(auPTS, au)
for _, au := range aus {
err := m.currentSegment.writeAAC(pts, au)
if err != nil {
return err
}
@ -161,6 +159,8 @@ func (m *Muxer) WriteAAC(pts time.Duration, aus [][]byte) error { @@ -161,6 +159,8 @@ func (m *Muxer) WriteAAC(pts time.Duration, aus [][]byte) error {
if m.videoTrack == nil {
m.audioAUCount++
}
pts += 1000 * time.Second / time.Duration(m.aacConf.SampleRate)
}
return nil

Loading…
Cancel
Save