Fix MP4 consumer with only audio

This commit is contained in:
Alexey Khit
2023-08-21 07:31:21 +03:00
parent c1c1d84cef
commit f80f179e4c
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -52,6 +52,18 @@ func (c *Codec) IsRTP() bool {
return c.PayloadType != PayloadTypeRAW
}
func (c *Codec) IsVideo() bool {
return c.Kind() == KindVideo
}
func (c *Codec) IsAudio() bool {
return c.Kind() == KindAudio
}
func (c *Codec) Kind() string {
return GetKind(c.Name)
}
func (c *Codec) Clone() *Codec {
clone := *c
return &clone
+4
View File
@@ -153,6 +153,10 @@ func (c *Consumer) AddTrack(media *core.Media, _ *core.Codec, track *core.Receiv
}
func (c *Consumer) WriteTo(wr io.Writer) (int64, error) {
if len(c.Senders) == 1 && c.Senders[0].Codec.IsAudio() {
c.start = true
}
init, err := c.muxer.GetInit()
if err != nil {
return 0, err