Skip to content

Commit

Permalink
forwarding_fiters に対応する
Browse files Browse the repository at this point in the history
  • Loading branch information
zztkm committed Dec 13, 2024
1 parent 64c1657 commit 717a2d8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import kotlin.concurrent.schedule
* @param dataChannels connect メッセージに含める `data_channels`
* @param bundleId connect メッセージに含める `bundle_id`
* @param forwardingFilterOption 転送フィルター機能の設定
* @param forwardingFiltersOption マルチ転送フィルター機能の設定
*/
class SoraMediaChannel @JvmOverloads constructor(
private val context: Context,
Expand All @@ -87,6 +88,7 @@ class SoraMediaChannel @JvmOverloads constructor(
dataChannels: List<Map<String, Any>>? = null,
private var bundleId: String? = null,
private val forwardingFilterOption: SoraForwardingFilterOption? = null,
private val forwardingFiltersOption: List<SoraForwardingFilterOption>? = null,
) {
companion object {
private val TAG = SoraMediaChannel::class.simpleName
Expand Down Expand Up @@ -672,6 +674,7 @@ class SoraMediaChannel @JvmOverloads constructor(
|bundleId = ${this.bundleId}
|signalingNotifyMetadata = ${this.signalingNotifyMetadata}
|forwardingFilter = ${this.forwardingFilterOption}
|forwardingFilters = ${this.forwardingFiltersOption}
""".trimMargin()
)

Expand Down Expand Up @@ -781,7 +784,8 @@ class SoraMediaChannel @JvmOverloads constructor(
signalingNotifyMetadata = signalingNotifyMetadata,
connectDataChannels = connectDataChannels,
redirect = redirectLocation != null,
forwardingFilterOption = forwardingFilterOption
forwardingFilterOption = forwardingFilterOption,
forwardingFiltersOption = forwardingFiltersOption
)
signaling!!.connect()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ package jp.shiguredo.sora.sdk.channel.option
* @param metadata 転送フィルターのメタデータ
*/
class SoraForwardingFilterOption(
var name: String? = null,
var priority: Int? = null,
val action: Action? = null,
val rules: List<List<Rule>>,
val version: String? = null,
Expand Down Expand Up @@ -66,6 +68,8 @@ class SoraForwardingFilterOption(
internal val signaling: Any
get() {
return mapOf(
"name" to name,
"priority" to priority,
"action" to (action?.name?.lowercase() ?: null),
"rules" to rules.map { outerRule ->
outerRule.map { rule ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class SignalingChannelImpl @JvmOverloads constructor(
private val connectDataChannels: List<Map<String, Any>>? = null,
private val redirect: Boolean = false,
private val forwardingFilterOption: SoraForwardingFilterOption? = null,
private val forwardingFiltersOption: List<SoraForwardingFilterOption>? = null,
) : SignalingChannel {

companion object {
Expand Down Expand Up @@ -260,7 +261,8 @@ class SignalingChannelImpl @JvmOverloads constructor(
signalingNotifyMetadata = signalingNotifyMetadata,
dataChannels = connectDataChannels,
redirect = redirect,
forwardingFilterOption = forwardingFilterOption
forwardingFilterOption = forwardingFilterOption,
forwardingFiltersOption = forwardingFiltersOption
)
it.send(message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ data class ConnectMessage(
@SerializedName("audio_streaming_language_code")
val audioStreamingLanguageCode: String? = null,
@SerializedName("redirect") var redirect: Boolean? = null,
@SerializedName("forwarding_filter") val forwardingFilter: Any? = null
@SerializedName("forwarding_filter") val forwardingFilter: Any? = null,
@SerializedName("forwarding_filters") val forwardingFilters: List<Any>? = null
)

data class VideoSetting(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class MessageConverter {
dataChannels: List<Map<String, Any>>? = null,
redirect: Boolean = false,
forwardingFilterOption: SoraForwardingFilterOption? = null,
forwardingFiltersOption: List<SoraForwardingFilterOption>? = null,
): String {

val msg = ConnectMessage(
Expand All @@ -60,6 +61,7 @@ class MessageConverter {
signalingNotifyMetadata = signalingNotifyMetadata,
audioStreamingLanguageCode = mediaOption.audioStreamingLanguageCode,
forwardingFilter = forwardingFilterOption?.signaling,
forwardingFilters = forwardingFiltersOption?.map { it.signaling }
)

if (mediaOption.upstreamIsRequired) {
Expand Down

0 comments on commit 717a2d8

Please sign in to comment.