@@ -5,6 +5,7 @@ package ivfwriter
5
5
6
6
import (
7
7
"bytes"
8
+ "encoding/binary"
8
9
"io"
9
10
"testing"
10
11
@@ -257,19 +258,25 @@ func TestIVFWriter_AV1(t *testing.T) {
257
258
t .Run ("Unfragmented" , func (t * testing.T ) {
258
259
buffer := & bytes.Buffer {}
259
260
260
- writer , err := NewWith (buffer , WithCodec (mimeTypeAV1 ))
261
- assert .NoError (t , err )
261
+ expectedTimestamp := uint32 (3653407706 )
262
262
263
- assert .NoError (t , writer .WriteRTP (& rtp.Packet {Payload : []byte {0x00 , 0x01 , 0xFF }}))
264
- assert .NoError (t , writer .Close ())
265
- assert .Equal (t , buffer .Bytes (), []byte {
263
+ // the timestamp is an uint32, 4 bytes from offset 36
264
+ expectedPayloadWithTimestamp := []byte {
266
265
0x44 , 0x4b , 0x49 , 0x46 , 0x0 , 0x0 , 0x20 ,
267
266
0x0 , 0x41 , 0x56 , 0x30 , 0x31 , 0x80 , 0x2 ,
268
267
0xe0 , 0x1 , 0x1e , 0x0 , 0x0 , 0x0 , 0x1 , 0x0 ,
269
268
0x0 , 0x0 , 0x84 , 0x3 , 0x0 , 0x0 , 0x0 , 0x0 ,
270
- 0x0 , 0x0 , 0x1 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
271
- 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0xff ,
272
- })
269
+ 0x0 , 0x0 , 0x1 , 0x0 , 0x0 , 0x0 , 0xda , 0x93 , 0xc2 ,
270
+ 0xd9 , 0x0 , 0x0 , 0x0 , 0x0 , 0xff ,
271
+ }
272
+
273
+ writer , err := NewWith (buffer , WithCodec (mimeTypeAV1 ))
274
+ assert .NoError (t , err )
275
+
276
+ assert .NoError (t , writer .WriteRTP (& rtp.Packet {Header : rtp.Header {Timestamp : expectedTimestamp }, Payload : []byte {0x00 , 0x01 , 0xFF }}))
277
+ assert .NoError (t , writer .Close ())
278
+ assert .Equal (t , expectedPayloadWithTimestamp , buffer .Bytes ())
279
+ assert .Equal (t , expectedTimestamp , binary .LittleEndian .Uint32 (expectedPayloadWithTimestamp [36 :40 ]))
273
280
})
274
281
275
282
t .Run ("Fragmented" , func (t * testing.T ) {
0 commit comments