Skip to content

Commit

Permalink
Revert "Adapt an existing test to provide coverage"
Browse files Browse the repository at this point in the history
This reverts commit dbe26d3.
  • Loading branch information
xdrudis authored and edaniels committed Jan 2, 2025
1 parent 0ae39fd commit 8b3734e
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions pkg/media/ivfwriter/ivfwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package ivfwriter

import (
"bytes"
"encoding/binary"
"io"
"testing"

Expand Down Expand Up @@ -258,25 +257,19 @@ func TestIVFWriter_AV1(t *testing.T) {
t.Run("Unfragmented", func(t *testing.T) {
buffer := &bytes.Buffer{}

expectedTimestamp := uint32(3653407706)
writer, err := NewWith(buffer, WithCodec(mimeTypeAV1))
assert.NoError(t, err)

// the timestamp is an uint32, 4 bytes from offset 36
expectedPayloadWithTimestamp := []byte{
assert.NoError(t, writer.WriteRTP(&rtp.Packet{Payload: []byte{0x00, 0x01, 0xFF}}))
assert.NoError(t, writer.Close())
assert.Equal(t, buffer.Bytes(), []byte{
0x44, 0x4b, 0x49, 0x46, 0x0, 0x0, 0x20,
0x0, 0x41, 0x56, 0x30, 0x31, 0x80, 0x2,
0xe0, 0x1, 0x1e, 0x0, 0x0, 0x0, 0x1, 0x0,
0x0, 0x0, 0x84, 0x3, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xda, 0x93, 0xc2,
0xd9, 0x0, 0x0, 0x0, 0x0, 0xff,
}

writer, err := NewWith(buffer, WithCodec(mimeTypeAV1))
assert.NoError(t, err)

assert.NoError(t, writer.WriteRTP(&rtp.Packet{Header: rtp.Header{Timestamp: expectedTimestamp}, Payload: []byte{0x00, 0x01, 0xFF}}))
assert.NoError(t, writer.Close())
assert.Equal(t, expectedPayloadWithTimestamp, buffer.Bytes())
assert.Equal(t, expectedTimestamp, binary.LittleEndian.Uint32(expectedPayloadWithTimestamp[36:40]))
0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0xff,
})
})

t.Run("Fragmented", func(t *testing.T) {
Expand Down

0 comments on commit 8b3734e

Please sign in to comment.