Add MimeCodecs to mp4 Muxer

This commit is contained in:
Alexey Khit
2023-01-30 19:15:05 +03:00
parent c1d6adc189
commit 0f934be9b6
3 changed files with 9 additions and 5 deletions
+5 -1
View File
@@ -171,8 +171,12 @@ func (c *Consumer) AddTrack(media *streamer.Media, track *streamer.Track) *strea
panic("unsupported codec")
}
func (c *Consumer) MimeCodecs() string {
return c.muxer.MimeCodecs(c.codecs)
}
func (c *Consumer) MimeType() string {
return c.muxer.MimeType(c.codecs)
return `video/mp4; codecs="` + c.MimeCodecs() + `"`
}
func (c *Consumer) Init() ([]byte, error) {
+3 -3
View File
@@ -24,8 +24,8 @@ const (
MimeOpus = "opus"
)
func (m *Muxer) MimeType(codecs []*streamer.Codec) string {
s := `video/mp4; codecs="`
func (m *Muxer) MimeCodecs(codecs []*streamer.Codec) string {
var s string
for i, codec := range codecs {
if i > 0 {
@@ -46,7 +46,7 @@ func (m *Muxer) MimeType(codecs []*streamer.Codec) string {
}
}
return s + `"`
return s
}
func (m *Muxer) GetInit(codecs []*streamer.Codec) ([]byte, error) {
+1 -1
View File
@@ -50,7 +50,7 @@ func (c *Segment) AddTrack(media *streamer.Media, track *streamer.Track) *stream
return nil
}
c.MimeType = muxer.MimeType(codecs)
c.MimeType = `video/mp4; codecs="` + muxer.MimeCodecs(codecs) + `"`
switch track.Codec.Name {
case streamer.CodecH264: