mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-29 22:42:00 -08:00
hls: set audio codec mime according to mpeg4 type
This commit is contained in:
parent
4c7da3d80e
commit
4bd5289221
2 changed files with 5 additions and 2 deletions
|
|
@ -38,7 +38,7 @@ func NewMuxer(
|
|||
}
|
||||
}
|
||||
|
||||
primaryPlaylist := newMuxerPrimaryPlaylist(videoTrack, audioTrack, h264Conf)
|
||||
primaryPlaylist := newMuxerPrimaryPlaylist(videoTrack, audioTrack, h264Conf, aacConf)
|
||||
|
||||
streamPlaylist := newMuxerStreamPlaylist(hlsSegmentCount)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/aler9/gortsplib"
|
||||
|
|
@ -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(
|
|||
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…
Add table
Add a link
Reference in a new issue