Skip to content

Commit

Permalink
Add AudioDeviceType::Unsupported(i32) variant, as future-proofing
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 committed Apr 27, 2022
1 parent d6325ca commit 10b56d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/java_interface/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub enum AudioDeviceType {
UsbHeadset = 22,
WiredHeadphones = 4,
WiredHeadset = 3,
Unsupported(i32),
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/java_interface/devices_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn try_request_devices_info<'a>(
device_type: FromPrimitive::from_i32(call_method_no_args_ret_int(
env, device, "getType",
)?)
.unwrap(),
.unwrap_or_else(|device_type| Unsupported(device_type)),
direction: AudioDeviceDirection::new(
call_method_no_args_ret_bool(env, device, "isSource")?,
call_method_no_args_ret_bool(env, device, "isSink")?,
Expand Down

0 comments on commit 10b56d1

Please sign in to comment.