Browse Source

hls: set audio codec mime according to mpeg4 type

pull/846/head
aler9 5 years ago
parent
commit
4bd5289221
  1. 2
      internal/hls/muxer.go
  2. 5
      internal/hls/muxer_primary_playlist.go

2
internal/hls/muxer.go

@ -38,7 +38,7 @@ func NewMuxer( @@ -38,7 +38,7 @@ func NewMuxer(
}
}
primaryPlaylist := newMuxerPrimaryPlaylist(videoTrack, audioTrack, h264Conf)
primaryPlaylist := newMuxerPrimaryPlaylist(videoTrack, audioTrack, h264Conf, aacConf)
streamPlaylist := newMuxerStreamPlaylist(hlsSegmentCount)

5
internal/hls/muxer_primary_playlist.go

@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/hex"
"io"
"strconv"
"strings"
"github.com/aler9/gortsplib"
@ -21,6 +22,7 @@ func newMuxerPrimaryPlaylist( @@ -21,6 +22,7 @@ func newMuxerPrimaryPlaylist(
videoTrack *gortsplib.Track,
audioTrack *gortsplib.Track,
h264Conf *gortsplib.TrackConfigH264,
aacConf *gortsplib.TrackConfigAAC,
) *muxerPrimaryPlaylist {
p := &muxerPrimaryPlaylist{
videoTrack: videoTrack,
@ -34,8 +36,9 @@ func newMuxerPrimaryPlaylist( @@ -34,8 +36,9 @@ func newMuxerPrimaryPlaylist(
codecs = append(codecs, "avc1."+hex.EncodeToString(p.h264Conf.SPS[1:4]))
}
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter
if p.audioTrack != nil {
codecs = append(codecs, "mp4a.40.2")
codecs = append(codecs, "mp4a.40."+strconv.FormatInt(int64(aacConf.Type), 10))
}
p.cnt = []byte("#EXTM3U\n" +

Loading…
Cancel
Save