Skip to content

Commit 6b990d8

Browse files
afq984Chromeos LUCI
authored and
Chromeos LUCI
committed
Make beamforming and style transfer mutually exclusive
Preferring beamforming if both are allowed. BUG=b:327530996 BUG=b:233174542 TEST=bazel test //... Change-Id: I4a0b5eacce1357433d8d2f854b2913c742feacd0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5531305 Reviewed-by: Cranel W <[email protected]> Tested-by: [email protected] <[email protected]> Commit-Queue: Li-Yu Yu <[email protected]>
1 parent fe802ae commit 6b990d8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cras/server/s2/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,21 @@ struct Output {
2929
}
3030

3131
fn resolve(input: &Input) -> Output {
32+
let beamforming_supported = input.ucm_suffix == "omniknight.3mic";
3233
Output {
3334
ap_nc_allowed: input.ap_nc_featured_allowed
3435
|| input.ap_nc_segmentation_allowed
3536
|| input.ap_nc_feature_tier_allowed,
3637
style_transfer_supported: input.style_transfer_featured_allowed
37-
&& input.ap_nc_segmentation_allowed,
38+
&& input.ap_nc_segmentation_allowed
39+
&& !beamforming_supported,
3840
// It's 'or' here because before the toggle of StyleTransfer is landed, users
3941
// should be able to control the feature only by the feature flag and there
4042
// would be only tests writing its system state currently.
4143
// TODO(b/327530996): handle tests: enabled without featured allowed.
4244
style_transfer_enabled: input.style_transfer_featured_allowed
4345
|| input.style_transfer_enabled,
44-
beamforming_supported: input.ucm_suffix == "omniknight.3mic",
46+
beamforming_supported,
4547
}
4648
}
4749

@@ -162,12 +164,17 @@ mod tests {
162164
#[test]
163165
fn test_beamforming() {
164166
let mut s = S2::new();
167+
s.set_ap_nc_segmentation_allowed(true);
168+
s.set_style_transfer_featured_allowed(true);
165169
assert!(!s.output.beamforming_supported);
170+
assert!(s.output.style_transfer_supported);
166171

167172
s.set_ucm_suffix("omniknight.3mic");
168173
assert!(s.output.beamforming_supported);
174+
assert!(!s.output.style_transfer_supported);
169175

170176
s.set_ucm_suffix("omniknight");
171177
assert!(!s.output.beamforming_supported);
178+
assert!(s.output.style_transfer_supported);
172179
}
173180
}

0 commit comments

Comments
 (0)