mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
test: fix and assert that all tracks are recorded (#5166)
Some checks failed
code_lint / go (push) Has been cancelled
code_lint / go_mod (push) Has been cancelled
code_lint / docs (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_e2e (push) Has been cancelled
Some checks failed
code_lint / go (push) Has been cancelled
code_lint / go_mod (push) Has been cancelled
code_lint / docs (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_e2e (push) Has been cancelled
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
parent
e168d2f3f4
commit
b4e4f54729
1 changed files with 87 additions and 6 deletions
|
|
@ -90,9 +90,22 @@ func TestRecorder(t *testing.T) {
|
||||||
strm.WriteUnit(desc.Medias[1], desc.Medias[1].Formats[0], &unit.Unit{
|
strm.WriteUnit(desc.Medias[1], desc.Medias[1].Formats[0], &unit.Unit{
|
||||||
PTS: pts,
|
PTS: pts,
|
||||||
Payload: unit.PayloadH265{
|
Payload: unit.PayloadH265{
|
||||||
test.FormatH265.VPS,
|
{
|
||||||
test.FormatH265.SPS,
|
0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60,
|
||||||
test.FormatH265.PPS,
|
0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03,
|
||||||
|
0x00, 0x00, 0x03, 0x00, 0x78, 0xba, 0x02, 0x40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03,
|
||||||
|
0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,
|
||||||
|
0x00, 0x78, 0xa0, 0x03, 0xc0, 0x80, 0x11, 0x07,
|
||||||
|
0xcb, 0x96, 0xe9, 0x29, 0x30, 0xbc, 0x05, 0xa0,
|
||||||
|
0x20, 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00,
|
||||||
|
0x03, 0x03, 0xc1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x44, 0x01, 0xc0, 0x73, 0xc1, 0x89,
|
||||||
|
},
|
||||||
{0x26, 0x1, 0xaf, 0x8, 0x42, 0x23, 0x48, 0x8a, 0x43, 0xe2},
|
{0x26, 0x1, 0xaf, 0x8, 0x42, 0x23, 0x48, 0x8a, 0x43, 0xe2},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
@ -238,9 +251,22 @@ func TestRecorder(t *testing.T) {
|
||||||
ID: 2,
|
ID: 2,
|
||||||
TimeScale: 90000,
|
TimeScale: 90000,
|
||||||
Codec: &mp4.CodecH265{
|
Codec: &mp4.CodecH265{
|
||||||
VPS: test.FormatH265.VPS,
|
VPS: []byte{
|
||||||
SPS: test.FormatH265.SPS,
|
0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60,
|
||||||
PPS: test.FormatH265.PPS,
|
0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03,
|
||||||
|
0x00, 0x00, 0x03, 0x00, 0x78, 0xba, 0x02, 0x40,
|
||||||
|
},
|
||||||
|
SPS: []byte{
|
||||||
|
0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03,
|
||||||
|
0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,
|
||||||
|
0x00, 0x78, 0xa0, 0x03, 0xc0, 0x80, 0x11, 0x07,
|
||||||
|
0xcb, 0x96, 0xe9, 0x29, 0x30, 0xbc, 0x05, 0xa0,
|
||||||
|
0x20, 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00,
|
||||||
|
0x03, 0x03, 0xc1,
|
||||||
|
},
|
||||||
|
PPS: []byte{
|
||||||
|
0x44, 0x01, 0xc0, 0x73, 0xc1, 0x89,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -307,6 +333,61 @@ func TestRecorder(t *testing.T) {
|
||||||
|
|
||||||
_, err = os.Stat(filepath.Join(dir, "mypath", "2010-05-20_22-15-25-000000."+ext))
|
_, err = os.Stat(filepath.Join(dir, "mypath", "2010-05-20_22-15-25-000000."+ext))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
if ca == "fmp4" {
|
||||||
|
var byts []byte
|
||||||
|
byts, err = os.ReadFile(filepath.Join(dir, "mypath", "2008-05-20_22-15-25-000000.mp4"))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
var parts fmp4.Parts
|
||||||
|
err = parts.Unmarshal(byts)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
for _, part := range parts {
|
||||||
|
for _, track := range part.Tracks {
|
||||||
|
track.Samples = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require.Equal(t, fmp4.Parts{
|
||||||
|
{
|
||||||
|
Tracks: []*fmp4.PartTrack{{
|
||||||
|
ID: 1,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SequenceNumber: 1,
|
||||||
|
Tracks: []*fmp4.PartTrack{{
|
||||||
|
ID: 2,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SequenceNumber: 2,
|
||||||
|
Tracks: []*fmp4.PartTrack{{
|
||||||
|
ID: 3,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SequenceNumber: 3,
|
||||||
|
Tracks: []*fmp4.PartTrack{{
|
||||||
|
ID: 4,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SequenceNumber: 4,
|
||||||
|
Tracks: []*fmp4.PartTrack{{
|
||||||
|
ID: 5,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SequenceNumber: 5,
|
||||||
|
Tracks: []*fmp4.PartTrack{{
|
||||||
|
ID: 1,
|
||||||
|
BaseTime: 9000,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
}, parts)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue