Skip to content

Commit

Permalink
processor_override: Give input its own message
Browse files Browse the repository at this point in the history
BUG=b:273232671
TEST=uncomment input.enabled in /etc/cras/processor_override.txtpb

Change-Id: I11aeab35146268f91f2e752522f0e005595a5bd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5020343
Auto-Submit: Li-Yu Yu <aaronyu@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Li-Yu Yu <aaronyu@google.com>
Tested-by: chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com <chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com>
  • Loading branch information
afq984 authored and Chromeos LUCI committed Nov 15, 2023
1 parent 89f8005 commit 7255fbc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
28 changes: 16 additions & 12 deletions cras-config/processor_override.txtpb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Uncomment the following line to override CRAS processing.
# enabled: true
# Input processing override.
input {
# Uncomment the following line to override CRAS input processing.
# enabled: true

# Block size of the processor.
# If 0, use the block size that cras_stream_apm is using.
block_size: 480
# Frame rate of the processor.
# If 0, use the rate that CRAS is using and no resampling is done.
frame_rate: 48000
# Block size of the processor.
# If 0, use the block size that cras_stream_apm is using.
block_size: 480
# Frame rate of the processor.
# If 0, use the rate that CRAS is using and no resampling is done.
frame_rate: 48000

# The path to the plugin shared library.
plugin_path: "/usr/local/lib64/libtest_plugins.so"
# The path to the plugin shared library.
plugin_path: "/usr/local/lib64/libtest_plugins.so"

# The name of the function to create the plugin processor.
constructor: "abs_processor_create"
# The name of the function to create the plugin processor.
constructor: "abs_processor_create"
# constructor: "plugin_processor_create"
}
6 changes: 5 additions & 1 deletion cras/src/server/rust/proto/cras_processor.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
syntax = "proto3";

message CrasProcessorOverride {
message Plugin {
bool enabled = 1;
uint32 block_size = 2;
uint32 frame_rate = 3;
string plugin_path = 4;
string constructor = 5;
}

message CrasProcessorOverride {
Plugin input = 1;
}
4 changes: 2 additions & 2 deletions cras/src/server/rust/src/cras_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static GLOBAL_ID_COUNTER: AtomicUsize = AtomicUsize::new(0);

impl CrasProcessor {
fn new(mut config: CrasProcessorConfig) -> anyhow::Result<Self> {
let override_config = processor_override::read_system_config();
let override_config = processor_override::read_system_config().input;
if override_config.enabled {
config.effect = CrasProcessorEffect::Overridden;
}
Expand Down Expand Up @@ -275,5 +275,5 @@ pub unsafe extern "C" fn cras_processor_create(
/// Returns true if override is enabled in the system config file.
#[no_mangle]
pub extern "C" fn cras_processor_is_override_enabled() -> bool {
processor_override::read_system_config().enabled
processor_override::read_system_config().input.enabled
}

0 comments on commit 7255fbc

Please sign in to comment.