support reading AAC frames bigger than 1460 bytes with RTMP (#206)

This commit is contained in:
aler9 2021-03-24 21:35:23 +01:00
parent 8b427ba323
commit 10bf7bad43
4 changed files with 11 additions and 7 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.15
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/aler9/gortsplib v0.0.0-20210324140122-134201bc94ab
github.com/aler9/gortsplib v0.0.0-20210324203150-2df57fbf7525
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51

4
go.sum
View File

@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aler9/gortsplib v0.0.0-20210324140122-134201bc94ab h1:34pgyEddS+icjqyyODSIr7ioES9BTV9WetT+njqidJs=
github.com/aler9/gortsplib v0.0.0-20210324140122-134201bc94ab/go.mod h1:zVCg+TQX445hh1pC5QgAuuBvvXZMWLY1XYz626dGFqY=
github.com/aler9/gortsplib v0.0.0-20210324203150-2df57fbf7525 h1:0JfLr+A6HSX1MY4rJsgpmvDI6/qpnQxLFBslmmy+0XU=
github.com/aler9/gortsplib v0.0.0-20210324203150-2df57fbf7525/go.mod h1:zVCg+TQX445hh1pC5QgAuuBvvXZMWLY1XYz626dGFqY=
github.com/aler9/rtmp v0.0.0-20210309202041-2d7177b7300d h1:LAX8pNvYpGgFpKdbPpEZWjNkHbmyvjMrT3vO7s7aaKU=
github.com/aler9/rtmp v0.0.0-20210309202041-2d7177b7300d/go.mod h1:vzuE21rowz+lT1NGsWbreIvYulgBpCGnQyeTyFblUHc=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=

View File

@ -570,7 +570,7 @@ func (c *Client) runPublish() {
return fmt.Errorf("ERR: received an AAC frame, but track is not set up")
}
frame, err := aacEncoder.Encode([]*rtpaac.AUAndTimestamp{
frames, err := aacEncoder.Encode([]*rtpaac.AUAndTimestamp{
{
Timestamp: pkt.Time + pkt.CTime,
AU: pkt.Data,
@ -580,7 +580,9 @@ func (c *Client) runPublish() {
return fmt.Errorf("ERR while encoding AAC: %v", err)
}
onFrame(audioTrack.ID, frame)
for _, frame := range frames {
onFrame(audioTrack.ID, frame)
}
default:
return fmt.Errorf("ERR: unexpected packet: %v", pkt.Type)

View File

@ -242,7 +242,7 @@ func (s *Source) runInner() bool {
return fmt.Errorf("ERR: received an AAC frame, but track is not set up")
}
frame, err := aacEncoder.Encode([]*rtpaac.AUAndTimestamp{
frames, err := aacEncoder.Encode([]*rtpaac.AUAndTimestamp{
{
Timestamp: pkt.Time + pkt.CTime,
AU: pkt.Data,
@ -252,7 +252,9 @@ func (s *Source) runInner() bool {
return fmt.Errorf("ERR while encoding AAC: %v", err)
}
onFrame(audioTrack.ID, frame)
for _, frame := range frames {
onFrame(audioTrack.ID, frame)
}
default:
return fmt.Errorf("ERR: unexpected packet: %v", pkt.Type)