@@ -90,9 +90,22 @@ func TestRecorder(t *testing.T) {
9090 strm .WriteUnit (desc .Medias [1 ], desc .Medias [1 ].Formats [0 ], & unit.Unit {
9191 PTS : pts ,
9292 Payload : unit.PayloadH265 {
93- test .FormatH265 .VPS ,
94- test .FormatH265 .SPS ,
95- test .FormatH265 .PPS ,
93+ {
94+ 0x40 , 0x01 , 0x0c , 0x01 , 0xff , 0xff , 0x01 , 0x60 ,
95+ 0x00 , 0x00 , 0x03 , 0x00 , 0x90 , 0x00 , 0x00 , 0x03 ,
96+ 0x00 , 0x00 , 0x03 , 0x00 , 0x78 , 0xba , 0x02 , 0x40 ,
97+ },
98+ {
99+ 0x42 , 0x01 , 0x01 , 0x01 , 0x60 , 0x00 , 0x00 , 0x03 ,
100+ 0x00 , 0x90 , 0x00 , 0x00 , 0x03 , 0x00 , 0x00 , 0x03 ,
101+ 0x00 , 0x78 , 0xa0 , 0x03 , 0xc0 , 0x80 , 0x11 , 0x07 ,
102+ 0xcb , 0x96 , 0xe9 , 0x29 , 0x30 , 0xbc , 0x05 , 0xa0 ,
103+ 0x20 , 0x00 , 0x00 , 0x03 , 0x00 , 0x20 , 0x00 , 0x00 ,
104+ 0x03 , 0x03 , 0xc1 ,
105+ },
106+ {
107+ 0x44 , 0x01 , 0xc0 , 0x73 , 0xc1 , 0x89 ,
108+ },
96109 {0x26 , 0x1 , 0xaf , 0x8 , 0x42 , 0x23 , 0x48 , 0x8a , 0x43 , 0xe2 },
97110 },
98111 })
@@ -238,9 +251,22 @@ func TestRecorder(t *testing.T) {
238251 ID : 2 ,
239252 TimeScale : 90000 ,
240253 Codec : & mp4.CodecH265 {
241- VPS : test .FormatH265 .VPS ,
242- SPS : test .FormatH265 .SPS ,
243- PPS : test .FormatH265 .PPS ,
254+ VPS : []byte {
255+ 0x40 , 0x01 , 0x0c , 0x01 , 0xff , 0xff , 0x01 , 0x60 ,
256+ 0x00 , 0x00 , 0x03 , 0x00 , 0x90 , 0x00 , 0x00 , 0x03 ,
257+ 0x00 , 0x00 , 0x03 , 0x00 , 0x78 , 0xba , 0x02 , 0x40 ,
258+ },
259+ SPS : []byte {
260+ 0x42 , 0x01 , 0x01 , 0x01 , 0x60 , 0x00 , 0x00 , 0x03 ,
261+ 0x00 , 0x90 , 0x00 , 0x00 , 0x03 , 0x00 , 0x00 , 0x03 ,
262+ 0x00 , 0x78 , 0xa0 , 0x03 , 0xc0 , 0x80 , 0x11 , 0x07 ,
263+ 0xcb , 0x96 , 0xe9 , 0x29 , 0x30 , 0xbc , 0x05 , 0xa0 ,
264+ 0x20 , 0x00 , 0x00 , 0x03 , 0x00 , 0x20 , 0x00 , 0x00 ,
265+ 0x03 , 0x03 , 0xc1 ,
266+ },
267+ PPS : []byte {
268+ 0x44 , 0x01 , 0xc0 , 0x73 , 0xc1 , 0x89 ,
269+ },
244270 },
245271 },
246272 {
@@ -307,6 +333,61 @@ func TestRecorder(t *testing.T) {
307333
308334 _ , err = os .Stat (filepath .Join (dir , "mypath" , "2010-05-20_22-15-25-000000." + ext ))
309335 require .NoError (t , err )
336+
337+ if ca == "fmp4" {
338+ var byts []byte
339+ byts , err = os .ReadFile (filepath .Join (dir , "mypath" , "2008-05-20_22-15-25-000000.mp4" ))
340+ require .NoError (t , err )
341+
342+ var parts fmp4.Parts
343+ err = parts .Unmarshal (byts )
344+ require .NoError (t , err )
345+
346+ for _ , part := range parts {
347+ for _ , track := range part .Tracks {
348+ track .Samples = nil
349+ }
350+ }
351+
352+ require .Equal (t , fmp4.Parts {
353+ {
354+ Tracks : []* fmp4.PartTrack {{
355+ ID : 1 ,
356+ }},
357+ },
358+ {
359+ SequenceNumber : 1 ,
360+ Tracks : []* fmp4.PartTrack {{
361+ ID : 2 ,
362+ }},
363+ },
364+ {
365+ SequenceNumber : 2 ,
366+ Tracks : []* fmp4.PartTrack {{
367+ ID : 3 ,
368+ }},
369+ },
370+ {
371+ SequenceNumber : 3 ,
372+ Tracks : []* fmp4.PartTrack {{
373+ ID : 4 ,
374+ }},
375+ },
376+ {
377+ SequenceNumber : 4 ,
378+ Tracks : []* fmp4.PartTrack {{
379+ ID : 5 ,
380+ }},
381+ },
382+ {
383+ SequenceNumber : 5 ,
384+ Tracks : []* fmp4.PartTrack {{
385+ ID : 1 ,
386+ BaseTime : 9000 ,
387+ }},
388+ },
389+ }, parts )
390+ }
310391 })
311392 }
312393}
0 commit comments