mirror of
https://github.com/aler9/gortsplib
synced 2025-10-17 12:40:45 +08:00
rename pkg/acc into pkg/mpeg4audio
This commit is contained in:
@@ -15,10 +15,10 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/net/ipv4"
|
"golang.org/x/net/ipv4"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
|
||||||
"github.com/aler9/gortsplib/pkg/auth"
|
"github.com/aler9/gortsplib/pkg/auth"
|
||||||
"github.com/aler9/gortsplib/pkg/base"
|
"github.com/aler9/gortsplib/pkg/base"
|
||||||
"github.com/aler9/gortsplib/pkg/headers"
|
"github.com/aler9/gortsplib/pkg/headers"
|
||||||
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
"github.com/aler9/gortsplib/pkg/url"
|
"github.com/aler9/gortsplib/pkg/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ func TestClientReadTracks(t *testing.T) {
|
|||||||
|
|
||||||
track2 := &TrackAAC{
|
track2 := &TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 44100,
|
SampleRate: 44100,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
@@ -69,7 +69,7 @@ func TestClientReadTracks(t *testing.T) {
|
|||||||
|
|
||||||
track3 := &TrackAAC{
|
track3 := &TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 96000,
|
SampleRate: 96000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
|
@@ -5,7 +5,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib"
|
"github.com/aler9/gortsplib"
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ func main() {
|
|||||||
// create an AAC track
|
// create an AAC track
|
||||||
track := &gortsplib.TrackAAC{
|
track := &gortsplib.TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
package aac
|
|
||||||
|
|
||||||
// MPEG4AudioType is the type of a MPEG-4 Audio stream.
|
|
||||||
type MPEG4AudioType int
|
|
||||||
|
|
||||||
// MPEG-4 Audio types.
|
|
||||||
const (
|
|
||||||
MPEG4AudioTypeAACLC MPEG4AudioType = 2
|
|
||||||
)
|
|
@@ -1,5 +1,5 @@
|
|||||||
// Package aac contains utilities to work with the AAC codec.
|
// Package mpeg4audio contains utilities to work with MPEG-4 audio codecs.
|
||||||
package aac
|
package mpeg4audio
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// MaxAccessUnitSize is the maximum size of an Access Unit (AU).
|
// MaxAccessUnitSize is the maximum size of an Access Unit (AU).
|
@@ -1,4 +1,4 @@
|
|||||||
package aac
|
package mpeg4audio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
// ADTSPacket is an ADTS packet.
|
// ADTSPacket is an ADTS packet.
|
||||||
type ADTSPacket struct {
|
type ADTSPacket struct {
|
||||||
Type MPEG4AudioType
|
Type ObjectType
|
||||||
SampleRate int
|
SampleRate int
|
||||||
ChannelCount int
|
ChannelCount int
|
||||||
AU []byte
|
AU []byte
|
||||||
@@ -39,9 +39,9 @@ func (ps *ADTSPackets) Unmarshal(buf []byte) error {
|
|||||||
|
|
||||||
pkt := &ADTSPacket{}
|
pkt := &ADTSPacket{}
|
||||||
|
|
||||||
pkt.Type = MPEG4AudioType((buf[pos+2] >> 6) + 1)
|
pkt.Type = ObjectType((buf[pos+2] >> 6) + 1)
|
||||||
switch pkt.Type {
|
switch pkt.Type {
|
||||||
case MPEG4AudioTypeAACLC:
|
case ObjectTypeAACLC:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported audio type: %d", pkt.Type)
|
return fmt.Errorf("unsupported audio type: %d", pkt.Type)
|
||||||
}
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package aac
|
package mpeg4audio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
@@ -1,4 +1,4 @@
|
|||||||
package aac
|
package mpeg4audio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"github.com/aler9/gortsplib/pkg/bits"
|
"github.com/aler9/gortsplib/pkg/bits"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MPEG4AudioConfig is a MPEG-4 Audio configuration.
|
// Config is a MPEG-4 Audio configuration.
|
||||||
type MPEG4AudioConfig struct {
|
type Config struct {
|
||||||
Type MPEG4AudioType
|
Type ObjectType
|
||||||
SampleRate int
|
SampleRate int
|
||||||
ChannelCount int
|
ChannelCount int
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@ type MPEG4AudioConfig struct {
|
|||||||
CoreCoderDelay uint16
|
CoreCoderDelay uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal decodes an MPEG4AudioConfig.
|
// Unmarshal decodes a Config.
|
||||||
func (c *MPEG4AudioConfig) Unmarshal(buf []byte) error {
|
func (c *Config) Unmarshal(buf []byte) error {
|
||||||
// ref: ISO 14496-3
|
// ref: ISO 14496-3
|
||||||
|
|
||||||
pos := 0
|
pos := 0
|
||||||
@@ -28,10 +28,10 @@ func (c *MPEG4AudioConfig) Unmarshal(buf []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.Type = MPEG4AudioType(tmp)
|
c.Type = ObjectType(tmp)
|
||||||
|
|
||||||
switch c.Type {
|
switch c.Type {
|
||||||
case MPEG4AudioTypeAACLC:
|
case ObjectTypeAACLC:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported type: %d", c.Type)
|
return fmt.Errorf("unsupported type: %d", c.Type)
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ func (c *MPEG4AudioConfig) Unmarshal(buf []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c MPEG4AudioConfig) marshalSize() int {
|
func (c Config) marshalSize() int {
|
||||||
n := 5 + 4 + 3
|
n := 5 + 4 + 3
|
||||||
|
|
||||||
_, ok := reverseSampleRates[c.SampleRate]
|
_, ok := reverseSampleRates[c.SampleRate]
|
||||||
@@ -127,8 +127,8 @@ func (c MPEG4AudioConfig) marshalSize() int {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal encodes an MPEG4AudioConfig.
|
// Marshal encodes a Config.
|
||||||
func (c MPEG4AudioConfig) Marshal() ([]byte, error) {
|
func (c Config) Marshal() ([]byte, error) {
|
||||||
buf := make([]byte, c.marshalSize())
|
buf := make([]byte, c.marshalSize())
|
||||||
pos := 0
|
pos := 0
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package aac
|
package mpeg4audio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@@ -9,13 +9,13 @@ import (
|
|||||||
var configCases = []struct {
|
var configCases = []struct {
|
||||||
name string
|
name string
|
||||||
enc []byte
|
enc []byte
|
||||||
dec MPEG4AudioConfig
|
dec Config
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"aac-lc 16khz mono",
|
"aac-lc 16khz mono",
|
||||||
[]byte{0x14, 0x08},
|
[]byte{0x14, 0x08},
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: MPEG4AudioTypeAACLC,
|
Type: ObjectTypeAACLC,
|
||||||
SampleRate: 16000,
|
SampleRate: 16000,
|
||||||
ChannelCount: 1,
|
ChannelCount: 1,
|
||||||
},
|
},
|
||||||
@@ -23,8 +23,8 @@ var configCases = []struct {
|
|||||||
{
|
{
|
||||||
"aac-lc 44.1khz mono",
|
"aac-lc 44.1khz mono",
|
||||||
[]byte{0x12, 0x08},
|
[]byte{0x12, 0x08},
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: MPEG4AudioTypeAACLC,
|
Type: ObjectTypeAACLC,
|
||||||
SampleRate: 44100,
|
SampleRate: 44100,
|
||||||
ChannelCount: 1,
|
ChannelCount: 1,
|
||||||
},
|
},
|
||||||
@@ -32,8 +32,8 @@ var configCases = []struct {
|
|||||||
{
|
{
|
||||||
"aac-lc 44.1khz 5.1",
|
"aac-lc 44.1khz 5.1",
|
||||||
[]byte{0x12, 0x30},
|
[]byte{0x12, 0x30},
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: MPEG4AudioTypeAACLC,
|
Type: ObjectTypeAACLC,
|
||||||
SampleRate: 44100,
|
SampleRate: 44100,
|
||||||
ChannelCount: 6,
|
ChannelCount: 6,
|
||||||
},
|
},
|
||||||
@@ -41,8 +41,8 @@ var configCases = []struct {
|
|||||||
{
|
{
|
||||||
"aac-lc 48khz stereo",
|
"aac-lc 48khz stereo",
|
||||||
[]byte{17, 144},
|
[]byte{17, 144},
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: MPEG4AudioTypeAACLC,
|
Type: ObjectTypeAACLC,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
},
|
},
|
||||||
@@ -50,8 +50,8 @@ var configCases = []struct {
|
|||||||
{
|
{
|
||||||
"aac-lc 53khz stereo",
|
"aac-lc 53khz stereo",
|
||||||
[]byte{0x17, 0x80, 0x67, 0x84, 0x10},
|
[]byte{0x17, 0x80, 0x67, 0x84, 0x10},
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: MPEG4AudioTypeAACLC,
|
Type: ObjectTypeAACLC,
|
||||||
SampleRate: 53000,
|
SampleRate: 53000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
},
|
},
|
||||||
@@ -59,8 +59,8 @@ var configCases = []struct {
|
|||||||
{
|
{
|
||||||
"aac-lc 96khz stereo delay",
|
"aac-lc 96khz stereo delay",
|
||||||
[]byte{0x10, 0x12, 0x0c, 0x08},
|
[]byte{0x10, 0x12, 0x0c, 0x08},
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: MPEG4AudioTypeAACLC,
|
Type: ObjectTypeAACLC,
|
||||||
SampleRate: 96000,
|
SampleRate: 96000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
DependsOnCoreCoder: true,
|
DependsOnCoreCoder: true,
|
||||||
@@ -72,7 +72,7 @@ var configCases = []struct {
|
|||||||
func TestConfigUnmarshal(t *testing.T) {
|
func TestConfigUnmarshal(t *testing.T) {
|
||||||
for _, ca := range configCases {
|
for _, ca := range configCases {
|
||||||
t.Run(ca.name, func(t *testing.T) {
|
t.Run(ca.name, func(t *testing.T) {
|
||||||
var dec MPEG4AudioConfig
|
var dec Config
|
||||||
err := dec.Unmarshal(ca.enc)
|
err := dec.Unmarshal(ca.enc)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, ca.dec, dec)
|
require.Equal(t, ca.dec, dec)
|
||||||
@@ -93,12 +93,12 @@ func TestConfigMarshal(t *testing.T) {
|
|||||||
func TestConfigMarshalErrors(t *testing.T) {
|
func TestConfigMarshalErrors(t *testing.T) {
|
||||||
for _, ca := range []struct {
|
for _, ca := range []struct {
|
||||||
name string
|
name string
|
||||||
conf MPEG4AudioConfig
|
conf Config
|
||||||
err string
|
err string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"invalid channel config",
|
"invalid channel config",
|
||||||
MPEG4AudioConfig{
|
Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 44100,
|
SampleRate: 44100,
|
||||||
ChannelCount: 0,
|
ChannelCount: 0,
|
9
pkg/mpeg4audio/objecttype.go
Normal file
9
pkg/mpeg4audio/objecttype.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package mpeg4audio
|
||||||
|
|
||||||
|
// ObjectType is a MPEG-4 Audio object type.
|
||||||
|
type ObjectType int
|
||||||
|
|
||||||
|
// supported types.
|
||||||
|
const (
|
||||||
|
ObjectTypeAACLC ObjectType = 2
|
||||||
|
)
|
@@ -1,4 +1,4 @@
|
|||||||
package aac
|
package mpeg4audio
|
||||||
|
|
||||||
var sampleRates = []int{
|
var sampleRates = []int{
|
||||||
96000,
|
96000,
|
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
|
||||||
"github.com/aler9/gortsplib/pkg/bits"
|
"github.com/aler9/gortsplib/pkg/bits"
|
||||||
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
"github.com/aler9/gortsplib/pkg/rtptimedec"
|
"github.com/aler9/gortsplib/pkg/rtptimedec"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ func (d *Decoder) Init() {
|
|||||||
|
|
||||||
// Decode decodes AUs from a RTP/AAC packet.
|
// Decode decodes AUs from a RTP/AAC packet.
|
||||||
// It returns the AUs and the PTS of the first AU.
|
// It returns the AUs and the PTS of the first AU.
|
||||||
// The PTS of subsequent AUs can be calculated by adding time.Second*aac.SamplesPerAccessUnit/clockRate.
|
// The PTS of subsequent AUs can be calculated by adding time.Second*mpeg4audio.SamplesPerAccessUnit/clockRate.
|
||||||
func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
||||||
if len(pkt.Payload) < 2 {
|
if len(pkt.Payload) < 2 {
|
||||||
d.fragmentedParts = d.fragmentedParts[:0]
|
d.fragmentedParts = d.fragmentedParts[:0]
|
||||||
@@ -118,10 +118,10 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, time.Duration, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
d.fragmentedSize += int(dataLens[0])
|
d.fragmentedSize += int(dataLens[0])
|
||||||
if d.fragmentedSize > aac.MaxAccessUnitSize {
|
if d.fragmentedSize > mpeg4audio.MaxAccessUnitSize {
|
||||||
d.fragmentedParts = d.fragmentedParts[:0]
|
d.fragmentedParts = d.fragmentedParts[:0]
|
||||||
d.fragmentedMode = false
|
d.fragmentedMode = false
|
||||||
return nil, 0, fmt.Errorf("AU size (%d) is too big (maximum is %d)", d.fragmentedSize, aac.MaxAccessUnitSize)
|
return nil, 0, fmt.Errorf("AU size (%d) is too big (maximum is %d)", d.fragmentedSize, mpeg4audio.MaxAccessUnitSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.fragmentedParts = append(d.fragmentedParts, payload[:dataLens[0]])
|
d.fragmentedParts = append(d.fragmentedParts, payload[:dataLens[0]])
|
||||||
@@ -214,7 +214,7 @@ func (d *Decoder) finalize(aus [][]byte) ([][]byte, error) {
|
|||||||
|
|
||||||
if len(aus) == 1 && len(aus[0]) >= 2 {
|
if len(aus) == 1 && len(aus[0]) >= 2 {
|
||||||
if aus[0][0] == 0xFF && (aus[0][1]&0xF0) == 0xF0 {
|
if aus[0][0] == 0xFF && (aus[0][1]&0xF0) == 0xF0 {
|
||||||
var pkts aac.ADTSPackets
|
var pkts mpeg4audio.ADTSPackets
|
||||||
err := pkts.Unmarshal(aus[0])
|
err := pkts.Unmarshal(aus[0])
|
||||||
if err == nil && len(pkts) == 1 {
|
if err == nil && len(pkts) == 1 {
|
||||||
d.adtsMode = true
|
d.adtsMode = true
|
||||||
@@ -227,7 +227,7 @@ func (d *Decoder) finalize(aus [][]byte) ([][]byte, error) {
|
|||||||
return nil, fmt.Errorf("multiple AUs in ADTS mode are not supported")
|
return nil, fmt.Errorf("multiple AUs in ADTS mode are not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
var pkts aac.ADTSPackets
|
var pkts mpeg4audio.ADTSPackets
|
||||||
err := pkts.Unmarshal(aus[0])
|
err := pkts.Unmarshal(aus[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to decode ADTS: %s", err)
|
return nil, fmt.Errorf("unable to decode ADTS: %s", err)
|
||||||
|
@@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
|
||||||
"github.com/aler9/gortsplib/pkg/bits"
|
"github.com/aler9/gortsplib/pkg/bits"
|
||||||
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
)
|
)
|
||||||
|
|
||||||
func randUint32() uint32 {
|
func randUint32() uint32 {
|
||||||
@@ -97,7 +97,7 @@ func (e *Encoder) Encode(aus [][]byte, firstPTS time.Duration) ([]*rtp.Packet, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rets = append(rets, pkts...)
|
rets = append(rets, pkts...)
|
||||||
pts += time.Duration(len(batch)) * aac.SamplesPerAccessUnit * time.Second / time.Duration(e.SampleRate)
|
pts += time.Duration(len(batch)) * mpeg4audio.SamplesPerAccessUnit * time.Second / time.Duration(e.SampleRate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize new batch
|
// initialize new batch
|
||||||
|
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mergeBytes(vals ...[]byte) []byte {
|
func mergeBytes(vals ...[]byte) []byte {
|
||||||
@@ -539,7 +539,7 @@ func TestDecode(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, expPTS, pts)
|
require.Equal(t, expPTS, pts)
|
||||||
aus = append(aus, addAUs...)
|
aus = append(aus, addAUs...)
|
||||||
expPTS += time.Duration(len(aus)) * aac.SamplesPerAccessUnit * time.Second / 48000
|
expPTS += time.Duration(len(aus)) * mpeg4audio.SamplesPerAccessUnit * time.Second / 48000
|
||||||
|
|
||||||
// test input integrity
|
// test input integrity
|
||||||
require.Equal(t, clone, pkt)
|
require.Equal(t, clone, pkt)
|
||||||
|
@@ -8,13 +8,13 @@ import (
|
|||||||
|
|
||||||
psdp "github.com/pion/sdp/v3"
|
psdp "github.com/pion/sdp/v3"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TrackAAC is an AAC track.
|
// TrackAAC is an AAC track.
|
||||||
type TrackAAC struct {
|
type TrackAAC struct {
|
||||||
PayloadType uint8
|
PayloadType uint8
|
||||||
Config *aac.MPEG4AudioConfig
|
Config *mpeg4audio.Config
|
||||||
SizeLength int
|
SizeLength int
|
||||||
IndexLength int
|
IndexLength int
|
||||||
IndexDeltaLength int
|
IndexDeltaLength int
|
||||||
@@ -63,7 +63,7 @@ func newTrackAACFromMediaDescription(
|
|||||||
return nil, fmt.Errorf("invalid AAC config (%v)", tmp[1])
|
return nil, fmt.Errorf("invalid AAC config (%v)", tmp[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Config = &aac.MPEG4AudioConfig{}
|
t.Config = &mpeg4audio.Config{}
|
||||||
err = t.Config.Unmarshal(enc)
|
err = t.Config.Unmarshal(enc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid AAC config (%v)", tmp[1])
|
return nil, fmt.Errorf("invalid AAC config (%v)", tmp[1])
|
||||||
|
@@ -6,13 +6,13 @@ import (
|
|||||||
psdp "github.com/pion/sdp/v3"
|
psdp "github.com/pion/sdp/v3"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTrackAACClone(t *testing.T) {
|
func TestTrackAACClone(t *testing.T) {
|
||||||
track := &TrackAAC{
|
track := &TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
@@ -30,7 +30,7 @@ func TestTrackAACClone(t *testing.T) {
|
|||||||
func TestTrackAACMediaDescription(t *testing.T) {
|
func TestTrackAACMediaDescription(t *testing.T) {
|
||||||
track := &TrackAAC{
|
track := &TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
|
@@ -6,7 +6,7 @@ import (
|
|||||||
psdp "github.com/pion/sdp/v3"
|
psdp "github.com/pion/sdp/v3"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/aler9/gortsplib/pkg/aac"
|
"github.com/aler9/gortsplib/pkg/mpeg4audio"
|
||||||
"github.com/aler9/gortsplib/pkg/url"
|
"github.com/aler9/gortsplib/pkg/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
@@ -105,7 +105,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
@@ -136,7 +136,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
@@ -171,7 +171,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
PayloadType: 96,
|
PayloadType: 96,
|
||||||
Config: &aac.MPEG4AudioConfig{
|
Config: &mpeg4audio.Config{
|
||||||
Type: 2,
|
Type: 2,
|
||||||
SampleRate: 48000,
|
SampleRate: 48000,
|
||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
|
Reference in New Issue
Block a user