parent
a1dc9f45f5
commit
afec0cd86c
|
@ -182,7 +182,7 @@ func tracksFromMetadata(conn *Conn, payload []interface{}) (format.Format, forma
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hasVideo && !hasAudio {
|
if !hasVideo && !hasAudio {
|
||||||
return nil, nil, fmt.Errorf("metadata doesn't contain any track")
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
firstReceived := false
|
firstReceived := false
|
||||||
|
@ -523,10 +523,12 @@ func (r *Reader) readTracks() (format.Format, format.Format, error) {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if videoTrack != nil || audioTrack != nil {
|
||||||
return videoTrack, audioTrack, nil
|
return videoTrack, audioTrack, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return tracksFromMessages(r.conn, msg)
|
return tracksFromMessages(r.conn, msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,64 @@ func TestReadTracks(t *testing.T) {
|
||||||
return buf
|
return buf
|
||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
|
&message.Audio{
|
||||||
|
ChunkStreamID: message.AudioChunkStreamID,
|
||||||
|
MessageStreamID: 0x1000000,
|
||||||
|
Codec: message.CodecMPEG4Audio,
|
||||||
|
Rate: message.Rate44100,
|
||||||
|
Depth: message.Depth16,
|
||||||
|
IsStereo: true,
|
||||||
|
AACType: message.AudioAACTypeConfig,
|
||||||
|
Payload: func() []byte {
|
||||||
|
enc, err2 := mpeg4audio.Config{
|
||||||
|
Type: 2,
|
||||||
|
SampleRate: 44100,
|
||||||
|
ChannelCount: 2,
|
||||||
|
}.Marshal()
|
||||||
|
require.NoError(t, err2)
|
||||||
|
return enc
|
||||||
|
}(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"h264 + aac, issue mediamtx/3301 (metadata without tracks)",
|
||||||
|
&format.H264{
|
||||||
|
PayloadTyp: 96,
|
||||||
|
SPS: test.FormatH264.SPS,
|
||||||
|
PPS: test.FormatH264.PPS,
|
||||||
|
PacketizationMode: 1,
|
||||||
|
},
|
||||||
|
&format.MPEG4Audio{
|
||||||
|
PayloadTyp: 96,
|
||||||
|
Config: &mpeg4audio.Config{
|
||||||
|
Type: 2,
|
||||||
|
SampleRate: 44100,
|
||||||
|
ChannelCount: 2,
|
||||||
|
},
|
||||||
|
SizeLength: 13,
|
||||||
|
IndexLength: 3,
|
||||||
|
IndexDeltaLength: 3,
|
||||||
|
},
|
||||||
|
[]message.Message{
|
||||||
|
&message.DataAMF0{
|
||||||
|
ChunkStreamID: 4,
|
||||||
|
MessageStreamID: 1,
|
||||||
|
Payload: []interface{}{
|
||||||
|
"@setDataFrame",
|
||||||
|
"onMetaData",
|
||||||
|
amf0.Object{
|
||||||
|
{
|
||||||
|
Key: "metadatacreator",
|
||||||
|
Value: "Agora.io SDK",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "encoder",
|
||||||
|
Value: "Agora.io Encoder",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
&message.Video{
|
&message.Video{
|
||||||
ChunkStreamID: message.VideoChunkStreamID,
|
ChunkStreamID: message.VideoChunkStreamID,
|
||||||
MessageStreamID: 0x1000000,
|
MessageStreamID: 0x1000000,
|
||||||
|
|
Loading…
Reference in New Issue