From a87111eccb607d34e8450523eedea8a6054397c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Fri, 17 Nov 2023 13:14:11 +0100 Subject: [PATCH 1/3] FBS: LayersChangeNotification body must be optional It's none when the spatial layer is -1 internally. --- rust/src/router/consumer.rs | 12 ++++++++---- worker/fbs/consumer.fbs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rust/src/router/consumer.rs b/rust/src/router/consumer.rs index cfc6e0697d..361868f2eb 100644 --- a/rust/src/router/consumer.rs +++ b/rust/src/router/consumer.rs @@ -621,11 +621,15 @@ impl Notification { panic!("Wrong message from worker: {notification:?}"); }; - let layers_fbs = - consumer::ConsumerLayers::try_from(body.layers().unwrap()).unwrap(); - let layers = ConsumerLayers::from_fbs(layers_fbs); + match body.layers().unwrap() { + Some(layers) => { + let layers_fbs = consumer::ConsumerLayers::try_from(layers).unwrap(); + let layers = ConsumerLayers::from_fbs(layers_fbs); - Ok(Notification::LayersChange(Some(layers))) + Ok(Notification::LayersChange(Some(layers))) + } + None => Ok(Notification::LayersChange(None)), + } } notification::Event::ConsumerTrace => { let Ok(Some(notification::BodyRef::ConsumerTraceNotification(body))) = diff --git a/worker/fbs/consumer.fbs b/worker/fbs/consumer.fbs index 660e1dedc9..715ce2bd53 100644 --- a/worker/fbs/consumer.fbs +++ b/worker/fbs/consumer.fbs @@ -80,7 +80,7 @@ table GetStatsResponse { // Notifications from Worker. table LayersChangeNotification { - layers: ConsumerLayers (required); + layers: ConsumerLayers; } table RtpNotification { From 9f04601e2235d2f373c1635474851a8acce8f43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Fri, 17 Nov 2023 13:17:31 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac74202929..97a81b3fbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog +### NEXT + +* FBS: Fix, LayersChangeNotification body must be optional ([1227](https://github.com/versatica/mediasoup/pull/1227)) + + ### 3.13.1 * Node: Extract version from `package.json` using `require()` ([PR #1217](https://github.com/versatica/mediasoup/pull/1217) by @arcinston). From 1d4da13592c373ae8f13a24b7f4b6a1b8233ed81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Fri, 17 Nov 2023 14:20:28 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a81b3fbb..a96e310f7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### NEXT -* FBS: Fix, LayersChangeNotification body must be optional ([1227](https://github.com/versatica/mediasoup/pull/1227)) +* FBS: `LayersChangeNotification` body must be optional ([PR #1227](https://github.com/versatica/mediasoup/pull/1227)). ### 3.13.1