Return 0 for the mask of any negative GstAudioChannelPosition value.

This commit is contained in:
Josh Matthews 2019-02-07 10:02:00 -05:00
parent 3ea34695dd
commit ae1455e4d6

View file

@ -20,8 +20,12 @@ use array_init;
impl AudioChannelPosition { impl AudioChannelPosition {
pub fn to_mask(self) -> u64 { pub fn to_mask(self) -> u64 {
let pos = self.to_glib();
if pos < 0 {
return 0;
}
unsafe { unsafe {
let val = mem::transmute::<ffi::GstAudioChannelPosition, u32>(self.to_glib()); let val = mem::transmute::<ffi::GstAudioChannelPosition, u32>(pos);
1 << val 1 << val
} }
} }