Skip to content

Commit

Permalink
Merge branch 'develop' into feature/update-multistream-connect-message
Browse files Browse the repository at this point in the history
  • Loading branch information
zztkm committed Jan 28, 2025
2 parents bef7bed + 91c9e89 commit 12e825f
Show file tree
Hide file tree
Showing 11 changed files with 259 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
54 changes: 50 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,50 @@

## develop

- [UPDATE] libwebrtc を 129.6668.1.0 に上げる
- @miosakuma
## 2025.1.0

**リリース日**: 2025-01-27

- [UPDATE] libwebrtc を 132.6834.5.0 に上げる
- @miosakuma @zztkm
- [UPDATE] SoraForwardingFilterOption 型の引数を Sora での 2025 年 12 月の廃止に向けて非推奨にする
- 今後はリスト形式の転送フィルター設定を利用してもらう
- 非推奨になるクラス
- SoraMediaChannel
- SignalingChannelImpl
- ConnectMessage (Any で定義されているが、実態は SoraForwardingFilterOption を Map に変換したもの)
- @zztkm
- [UPDATE] OfferMessage に項目を追加する
- 追加した項目
- `version`
- `simulcastMulticodec`
- `spotlight`
- `channelId`
- `sessionId`
- `audio`
- `audioCodecType`
- `audioBitRate`
- `video`
- `videoCodecType`
- `videoBitRate`
- @zztkm
- [UPDATE] NotificationMessage に項目を追加する
- 追加した項目
- `timestamp`
- `spotlightNumber`
- `failedConnectionId`
- `currentState`
- `previousState`
- @zztkm
- [ADD] 転送フィルター機能の設定を表すクラス `SoraForwardingFilterOption``name``priority` を追加する
- @zztkm
- [ADD] 転送フィルターをリスト形式で指定するためのプロパティを追加する
- プロパティが追加されるクラス
- SoraMediaChannel に `forwardingFiltersOption` を追加する
- SignalingChannelImpl に `forwardingFiltersOption` を追加する
- ConnectMessage に `forwardingFilters` を追加する
- クラスそのものに変更はないが `MessageConverter.buildConnectMessage``forwardingFiltersOption` を追加する
- @zztkm
- [FIX] SoraMediaChannel のコンストラクタで `signalingMetadata``signalingNotifyMetadata` に Map オブジェクトを指定した場合、null を持つフィールドが connect メッセージ送信時に省略されてしまう問題を修正
- `signalingMetadata``signalingNotifyMetadata` に設定する情報はユーザが任意に設定する項目であり value 値が null の情報も送信できるようにする必要がある
- Gson は JSON シリアライズ時、デフォルトで null フィールドを無視するので、null を持つフィールドは省略される
Expand All @@ -27,9 +69,13 @@

### misc

- [CHANGE] GitHub Actions の ubuntu-latest を ubuntu-24.04 に変更する
- @voluntas
- [UPDATE] システム条件を更新する
- Android Studio 2024.1.2 以降
- @miosakuma
- Android Studio 2024.2.2 以降
- @miosakuma @zztkm
- [ADD] Canary Release 用スクリプトの canary.py を追加する
- @zztkm

## 2024.3.1

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Sora Android SDK

[![Release](https://jitpack.io/v/shiguredo/sora-android-sdk.svg)](https://jitpack.io/#shiguredo/sora-android-sdk)
[![libwebrtc](https://img.shields.io/badge/libwebrtc-129.6668-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/6668)
[![libwebrtc](https://img.shields.io/badge/libwebrtc-132.6834-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/6834)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/shiguredo/sora-android-sdk.svg)](https://github.com/shiguredo/sora-android-sdk.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand All @@ -21,8 +21,8 @@ Please read https://github.com/shiguredo/oss before use.
## システム条件

- Android 5 以降 (エミュレーターでの動作は保証しません)
- Android Studio 2024.1.2 以降
- WebRTC SFU Sora 2024.1.0 以降
- Android Studio 2024.2.2 以降
- WebRTC SFU Sora 2024.2.0 以降

## サンプル

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'org.jetbrains.dokka'

buildscript {
ext.kotlin_version = '1.9.25'
ext.libwebrtc_version = '129.6668.1.0'
ext.libwebrtc_version = '132.6834.5.0'

ext.dokka_version = '1.8.10'

Expand Down
146 changes: 146 additions & 0 deletions canary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import argparse
import re
import subprocess


SDKINFO_FILE = "sora-android-sdk/src/main/kotlin/jp/shiguredo/sora/sdk/util/SDKInfo.kt"


def update_sdkinfo_version(packageinfo_content):
"""
SDKInfo.ktファイルの内容からバージョンを更新する
Args:
packageinfo_content (list): SDKInfo.ktファイルの各行を要素とするリスト
Returns:
tuple: (更新後のファイル内容のリスト, 新しいバージョン文字列)
Raises:
ValueError: バージョン指定が見つからない場合
"""
updated_content = []
sdk_version_updated = False
new_version = None

for line in packageinfo_content:
line = line.rstrip() # 末尾の改行のみを削除
if "const val version" in line:
# バージョン行のパターンマッチング
version_match = re.match(
r'\s*const\s+val\s+version\s*=\s*[\'"](\d+\.\d+\.\d+)(-canary\.(\d+))?[\'"]',
line,
)
if version_match:
major_minor_patch = version_match.group(1) # 基本バージョン (例: 1.0.0)
canary_suffix = version_match.group(2) # canaryサフィックス部分

# canaryサフィックスが無い場合は.0から開始、ある場合は番号をインクリメント
if canary_suffix is None:
new_version = f"{major_minor_patch}-canary.0"
else:
canary_number = int(version_match.group(3))
new_version = f"{major_minor_patch}-canary.{canary_number + 1}"

# SDKInfoのバージョン行を更新
updated_content.append(f' const val version = "{new_version}"')
sdk_version_updated = True
else:
updated_content.append(line)
else:
updated_content.append(line)

if not sdk_version_updated:
raise ValueError("Version specification not found in SDKInfo.kt file.")

return updated_content, new_version


def write_file(filename, updated_content, dry_run):
"""
更新後の内容をファイルに書き込む
Args:
filename (str): 書き込み対象のファイル名
updated_content (list): 更新後のファイル内容
dry_run (bool): True の場合は実際の書き込みを行わない
"""
if dry_run:
print(f"Dry run: The following changes would be written to {filename}:")
print("\n".join(updated_content))
else:
with open(filename, "w") as file:
file.write("\n".join(updated_content) + "\n")
print(f"{filename} updated.")


def git_operations(new_version, dry_run):
"""
Git操作(コミット、タグ付け、プッシュ)を実行
Args:
new_version (str): 新しいバージョン文字列(タグとして使用)
dry_run (bool): True の場合は実際のGit操作を行わない
"""
commit_message = f"[canary] Update SDKInfo.kt version to {new_version}"

if dry_run:
# dry-run時は実行されるコマンドを表示のみ
print(f"Dry run: Would execute git add {SDKINFO_FILE}")
print(f"Dry run: Would execute git commit -m '{commit_message}'")
print(f"Dry run: Would execute git tag {new_version}")
print(f"Dry run: Would execute git push origin develop")
print(f"Dry run: Would execute git push origin {new_version}")
else:
# ファイルをステージング
print(f"Executing: git add {SDKINFO_FILE}")
subprocess.run(["git", "add", SDKINFO_FILE], check=True)

# 変更をコミット
print(f"Executing: git commit -m '{commit_message}'")
subprocess.run(["git", "commit", "-m", commit_message], check=True)

# バージョンタグを作成
print(f"Executing: git tag {new_version}")
subprocess.run(["git", "tag", new_version], check=True)

# developブランチをプッシュ
print("Executing: git push origin develop")
subprocess.run(["git", "push", "origin", "develop"], check=True)

# タグをプッシュ
print(f"Executing: git push origin {new_version}")
subprocess.run(["git", "push", "origin", new_version], check=True)


def main():
"""
メイン処理:
1. コマンドライン引数の解析
2. SDKInfo.kt ファイルの読み込みと更新
3. Git操作の実行
"""
parser = argparse.ArgumentParser(
description="Update SDKInfo.kt version and push changes with git."
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Perform a dry run without making any changes.",
)
args = parser.parse_args()

# SDKInfo.kt を読み込んでバージョンを更新
with open(SDKINFO_FILE, "r") as file:
packageinfo_content = file.readlines()
updated_packageinfo_content, new_version = update_sdkinfo_version(
packageinfo_content
)
write_file(SDKINFO_FILE, updated_packageinfo_content, args.dry_run)

# Git操作の実行
git_operations(new_version, args.dry_run)


if __name__ == "__main__":
main()
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 @@ -86,7 +87,13 @@ class SoraMediaChannel @JvmOverloads constructor(
ignoreDisconnectWebSocket: Boolean? = null,
dataChannels: List<Map<String, Any>>? = null,
private var bundleId: String? = null,
@Deprecated(
"この項目は 2025 年 12 月リリース予定の Sora にて廃止されます",
ReplaceWith("forwardingFiltersOption"),
DeprecationLevel.WARNING
)
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 +679,7 @@ class SoraMediaChannel @JvmOverloads constructor(
|bundleId = ${this.bundleId}
|signalingNotifyMetadata = ${this.signalingNotifyMetadata}
|forwardingFilter = ${this.forwardingFilterOption}
|forwardingFilters = ${this.forwardingFiltersOption}
""".trimMargin()
)

Expand Down Expand Up @@ -781,7 +789,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 @@ -3,12 +3,16 @@ package jp.shiguredo.sora.sdk.channel.option
/**
* 転送フィルター機能の設定を表すクラスです。
*
* @param name 転送フィルターの名前
* @param priority 転送フィルターの優先度
* @param action 転送フィルター適用時の挙動
* @param rules 転送フィルターの適用ルール
* @param version 転送フィルターのバージョン
* @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 +70,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 @@ -68,7 +68,13 @@ class SignalingChannelImpl @JvmOverloads constructor(
private val signalingNotifyMetadata: Any? = null,
private val connectDataChannels: List<Map<String, Any>>? = null,
private val redirect: Boolean = false,
@Deprecated(
"この項目は 2025 年 12 月リリース予定の Sora にて廃止されます",
ReplaceWith("forwardingFiltersOption"),
DeprecationLevel.WARNING
)
private val forwardingFilterOption: SoraForwardingFilterOption? = null,
private val forwardingFiltersOption: List<SoraForwardingFilterOption>? = null,
) : SignalingChannel {

companion object {
Expand Down Expand Up @@ -260,7 +266,8 @@ class SignalingChannelImpl @JvmOverloads constructor(
signalingNotifyMetadata = signalingNotifyMetadata,
dataChannels = connectDataChannels,
redirect = redirect,
forwardingFilterOption = forwardingFilterOption
forwardingFilterOption = forwardingFilterOption,
forwardingFiltersOption = forwardingFiltersOption
)
it.send(message)
}
Expand Down
Loading

0 comments on commit 12e825f

Please sign in to comment.