Skip to content

Commit

Permalink
Add AudioDeviceType::Unsupported variant, as future-proofing
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 authored and katyo committed Apr 29, 2022
1 parent 7870018 commit c6d1d57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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 = -1,
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/java_interface/devices_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::{
call_method_no_args_ret_string, get_context, get_devices, get_system_service,
with_attached, JNIEnv, JObject, JResult,
},
AudioDeviceDirection, AudioDeviceInfo, Context,
AudioDeviceDirection, AudioDeviceInfo, AudioDeviceType, Context,
};

impl AudioDeviceInfo {
Expand Down 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(AudioDeviceType::Unsupported),
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 c6d1d57

Please sign in to comment.