Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add an endpointId field to StartEvent. #207

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ data class MediaFormat(
)
data class Start(
val tag: String,
val mediaFormat: MediaFormat
val mediaFormat: MediaFormat,
val customParameters: CustomParameters? = null
)

data class CustomParameters(
val endpointId: String?
)

data class Media(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.jitsi.mediajson
import com.fasterxml.jackson.databind.exc.InvalidFormatException
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf
import org.json.simple.JSONObject
Expand Down Expand Up @@ -45,6 +46,7 @@ class MediaJsonTest : ShouldSpec() {
val start = parsed["start"]
start.shouldBeInstanceOf<JSONObject>()
start["tag"] shouldBe tag
start["customParameters"] shouldBe null
val mediaFormat = start["mediaFormat"]
mediaFormat.shouldBeInstanceOf<JSONObject>()
mediaFormat["encoding"] shouldBe enc
Expand Down Expand Up @@ -105,7 +107,8 @@ class MediaJsonTest : ShouldSpec() {
"channels": 1
},
"customParameters": {
"text1":"12312"
"text1":"12312",
"endpointId": "abcdabcd"
}
}
}
Expand All @@ -119,6 +122,8 @@ class MediaJsonTest : ShouldSpec() {
parsed.start.mediaFormat.encoding shouldBe "audio/x-mulaw"
parsed.start.mediaFormat.sampleRate shouldBe 8000
parsed.start.mediaFormat.channels shouldBe 1
parsed.start.customParameters.shouldNotBeNull()
parsed.start.customParameters?.endpointId shouldBe "abcdabcd"
}
context("Start with sequence number as int") {
val parsed = Event.parse(
Expand All @@ -134,7 +139,8 @@ class MediaJsonTest : ShouldSpec() {
"channels": 1
},
"customParameters": {
"text1":"12312"
"text1":"12312",
"endpointId":"abcdabcd"
}
}
}
Expand All @@ -143,6 +149,8 @@ class MediaJsonTest : ShouldSpec() {

parsed.shouldBeInstanceOf<StartEvent>()
parsed.sequenceNumber shouldBe 0
parsed.start.customParameters.shouldNotBeNull()
parsed.start.customParameters?.endpointId shouldBe "abcdabcd"
}
context("Media") {
val parsed = Event.parse(
Expand Down
Loading