Skip to content

Commit 14c032c

Browse files
committed
Fix TestExtensionIdCollision
This test previously assumed deterministic (i.e. ordered) behaviour for getRTPParametersByKind which is not necessary, and is no longer true following PR #2236 due to use of range. The result was that occasionally this test would fail incorrectly (thanks, golang-ci). This PR fixes the test.
1 parent 89c05b7 commit 14c032c

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

mediaengine_test.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,26 @@ a=rtpmap:111 opus/48000/2
525525
extensions := params.HeaderExtensions
526526

527527
assert.Equal(t, 2, len(extensions))
528-
assert.Equal(t, sdp.SDESMidURI, extensions[0].URI)
529-
assert.Equal(t, 2, extensions[0].ID)
530-
assert.Equal(t, "urn:3gpp:video-orientation", extensions[1].URI)
531-
assert.NotEqual(t, 1, extensions[1].ID)
532-
assert.NotEqual(t, 2, extensions[1].ID)
533-
assert.NotEqual(t, 5, extensions[1].ID)
528+
529+
midIndex := -1;
530+
if extensions[0].URI == sdp.SDESMidURI {
531+
midIndex = 0
532+
} else if extensions[1].URI == sdp.SDESMidURI {
533+
midIndex = 1
534+
}
535+
536+
voIndex := -1;
537+
if extensions[0].URI == "urn:3gpp:video-orientation" {
538+
voIndex = 0
539+
} else if extensions[1].URI == "urn:3gpp:video-orientation" {
540+
voIndex = 1
541+
}
542+
543+
assert.NotEqual(t, midIndex, -1)
544+
assert.NotEqual(t, voIndex, -1)
545+
546+
assert.Equal(t, 2, extensions[midIndex].ID)
547+
assert.NotEqual(t, 1, extensions[voIndex].ID)
548+
assert.NotEqual(t, 2, extensions[voIndex].ID)
549+
assert.NotEqual(t, 5, extensions[voIndex].ID)
534550
}

0 commit comments

Comments
 (0)