diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index ef3c54684..8fdd0d36d 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -20,8 +20,12 @@ use array_init; impl AudioChannelPosition { pub fn to_mask(self) -> u64 { + let pos = self.to_glib(); + if pos < 0 { + return 0; + } unsafe { - let val = mem::transmute::(self.to_glib()); + let val = mem::transmute::(pos); 1 << val } }