From ae1455e4d6e429e9a443a03f9a2777031ee58d78 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 7 Feb 2019 10:02:00 -0500 Subject: [PATCH] Return 0 for the mask of any negative GstAudioChannelPosition value. --- gstreamer-audio/src/audio_channel_position.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 } }