From 0f775d30393838157bc9a7cbd567d5358da7ea61 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 26 Nov 2024 12:42:23 +0100 Subject: [PATCH 1/4] Add SetTargetTrackVariant media event --- fishjam/media_events/peer/peer.proto | 6 ++++++ .../lib/fishjam/media_events/peer/peer.pb.ex | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/fishjam/media_events/peer/peer.proto b/fishjam/media_events/peer/peer.proto index b3bd23b..1b7ea07 100644 --- a/fishjam/media_events/peer/peer.proto +++ b/fishjam/media_events/peer/peer.proto @@ -65,6 +65,11 @@ message MediaEvent { media_events.Variant variant = 2; } + message SetTargetTrackVariant { + string track_id = 1; + media_events.Variant variant = 2; + } + oneof content { Connect connect = 1; Disconnect disconnect = 2; @@ -76,5 +81,6 @@ message MediaEvent { TrackBitrates track_bitrates = 8; EnableTrackVariant enable_track_variant = 9; DisableTrackVariant disable_track_variant = 10; + SetTargetTrackVariant set_target_track_variant = 11; } } diff --git a/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex b/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex index 11e4b43..d5c524a 100644 --- a/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex +++ b/fishjam_protos/lib/fishjam/media_events/peer/peer.pb.ex @@ -128,6 +128,15 @@ defmodule Fishjam.MediaEvents.Peer.MediaEvent.EnableTrackVariant do field :variant, 2, type: Fishjam.MediaEvents.Variant, enum: true end +defmodule Fishjam.MediaEvents.Peer.MediaEvent.SetTargetTrackVariant do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.13.0" + + field :track_id, 1, type: :string, json_name: "trackId" + field :variant, 2, type: Fishjam.MediaEvents.Variant, enum: true +end + defmodule Fishjam.MediaEvents.Peer.MediaEvent do @moduledoc false @@ -174,4 +183,9 @@ defmodule Fishjam.MediaEvents.Peer.MediaEvent do type: Fishjam.MediaEvents.Peer.MediaEvent.DisableTrackVariant, json_name: "disableTrackVariant", oneof: 0 + + field :set_target_track_variant, 11, + type: Fishjam.MediaEvents.Peer.MediaEvent.SetTargetTrackVariant, + json_name: "setTargetTrackVariant", + oneof: 0 end From 06351b3893cf9665b83c68028d7a5d024f749971 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 26 Nov 2024 13:17:28 +0100 Subject: [PATCH 2/4] Update CI to check if docs are up to date --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 593d0e3..cb63072 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: if: ${{ !cancelled() && steps.compile.outcome == 'success' }} run: mix format --check-formatted - check-protobufs-update: + check-fishjam-protos-update: runs-on: ubuntu-latest name: Fishjam protos update strategy: @@ -62,7 +62,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Install protobuf compiler (protoc) if needed + - name: Install protobuf compiler (protoc) run: | sudo apt update sudo apt install -y protobuf-compiler @@ -75,10 +75,44 @@ jobs: run: bash compile_proto.sh working-directory: fishjam_protos - - name: Check for changes in protobuf files + - name: Check for changes in fishjam_protos files run: | if [[ -n $(git status --porcelain) ]]; then echo "Generated protobuf files are not up to date. Please regenerate them and commit the changes." git diff exit 1 fi + + - name: Generate docs + run: bash compile_proto.sh + working-directory: fishjam_protos + + check-protobufs-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v5 + + - name: Install protobuf compiler (protoc) + run: | + sudo apt update + sudo apt install -y protobuf-compiler + + - name: Install protobuf docs generator + run: | + go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest + + - name: Generate docs + run: | + protoc --doc_out=./doc --doc_opt=markdown,docs.md fishjam/**/*.proto + + - name: Check for changes in docs files + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "Generated docs files are not up to date. Please regenerate them and commit the changes." + git diff + exit 1 + fi From 5bdec58ba8878af6fde9b5f93cb386f999687741 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 26 Nov 2024 13:19:34 +0100 Subject: [PATCH 3/4] Update docs --- .github/workflows/ci.yml | 1 + doc/docs.md | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb63072..35753bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,7 @@ jobs: check-protobufs-docs: runs-on: ubuntu-latest + name: Protobuf docs update steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/doc/docs.md b/doc/docs.md index 42424f7..0a493d2 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -14,6 +14,7 @@ - [MediaEvent.SdpOffer.MidToTrackIdEntry](#fishjam-media_events-peer-MediaEvent-SdpOffer-MidToTrackIdEntry) - [MediaEvent.SdpOffer.TrackIdToBitratesEntry](#fishjam-media_events-peer-MediaEvent-SdpOffer-TrackIdToBitratesEntry) - [MediaEvent.SdpOffer.TrackIdToMetadataJsonEntry](#fishjam-media_events-peer-MediaEvent-SdpOffer-TrackIdToMetadataJsonEntry) + - [MediaEvent.SetTargetTrackVariant](#fishjam-media_events-peer-MediaEvent-SetTargetTrackVariant) - [MediaEvent.TrackBitrates](#fishjam-media_events-peer-MediaEvent-TrackBitrates) - [MediaEvent.UpdateEndpointMetadata](#fishjam-media_events-peer-MediaEvent-UpdateEndpointMetadata) - [MediaEvent.UpdateTrackMetadata](#fishjam-media_events-peer-MediaEvent-UpdateTrackMetadata) @@ -118,6 +119,7 @@ SCHEMAS | track_bitrates | [MediaEvent.TrackBitrates](#fishjam-media_events-peer-MediaEvent-TrackBitrates) | | | | enable_track_variant | [MediaEvent.EnableTrackVariant](#fishjam-media_events-peer-MediaEvent-EnableTrackVariant) | | | | disable_track_variant | [MediaEvent.DisableTrackVariant](#fishjam-media_events-peer-MediaEvent-DisableTrackVariant) | | | +| set_target_track_variant | [MediaEvent.SetTargetTrackVariant](#fishjam-media_events-peer-MediaEvent-SetTargetTrackVariant) | | | @@ -259,6 +261,22 @@ The "mid" is an identifier used to associate an RTP packet with an MLine + + +### MediaEvent.SetTargetTrackVariant + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| track_id | [string](#string) | | | +| variant | [fishjam.media_events.Variant](#fishjam-media_events-Variant) | | | + + + + + + ### MediaEvent.TrackBitrates From d2ed0907b1ab3f7dbc3d5717a499acabfa3d9f39 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Tue, 26 Nov 2024 14:20:56 +0100 Subject: [PATCH 4/4] Update docs script --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35753bd..bf09d11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Generate docs run: | - protoc --doc_out=./doc --doc_opt=markdown,docs.md fishjam/**/*.proto + find fishjam/ -name "*.proto" | sort | xargs protoc --doc_out=./doc --doc_opt=markdown,docs.md - name: Check for changes in docs files run: | diff --git a/README.md b/README.md index 74301b2..a6b2d52 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Install [protoc-gen-doc](https://github.com/pseudomuto/protoc-gen-doc) plugin. Use the command below: ```command -protoc --doc_out=./doc --doc_opt=markdown,docs.md fishjam/**/*.proto +find fishjam/ -name "*.proto" | sort | xargs protoc --doc_out=./doc --doc_opt=markdown,docs.md ``` ## Lint and formatting