Fix crash with JNI bindings during audio buffer overrun

Former-commit-id: 0bb39e057c5aa81c5f491314125a8853b1f65ab0
This commit is contained in:
Michel Heily 2020-04-19 22:24:23 +03:00
parent 90032373a8
commit d8d9fc0651

View file

@ -46,8 +46,12 @@ impl VideoInterface for Hardware {
} }
impl AudioInterface for Hardware { impl AudioInterface for Hardware {
fn push_sample(&mut self, sample: StereoSample<i16>) { fn push_sample(&mut self, sample: StereoSample<i16>) {
self.audio_buffer.prod.push(sample.0).unwrap(); if self.audio_buffer.prod.push(sample.0).is_err() {
self.audio_buffer.prod.push(sample.1).unwrap(); warn!("failed to push audio sample");
}
if self.audio_buffer.prod.push(sample.1).is_err() {
warn!("failed to push audio sample");
}
} }
} }
impl InputInterface for Hardware { impl InputInterface for Hardware {