tutorial/sinesrc: Simplify query handling code

This commit is contained in:
Sebastian Dröge 2019-04-24 12:11:51 +03:00
parent 8b49953a7a
commit 075cb97b3f

View file

@ -518,7 +518,7 @@ impl BaseSrcImpl for SineSrc {
QueryView::Scheduling(ref mut q) => { QueryView::Scheduling(ref mut q) => {
q.set(gst::SchedulingFlags::SEQUENTIAL, 1, -1, 0); q.set(gst::SchedulingFlags::SEQUENTIAL, 1, -1, 0);
q.add_scheduling_modes(&[gst::PadMode::Push]); q.add_scheduling_modes(&[gst::PadMode::Push]);
return true; true
} }
// In Live mode we will have a latency equal to the number of samples in each buffer. // In Live mode we will have a latency equal to the number of samples in each buffer.
// We can't output samples before they were produced, and the last sample of a buffer // We can't output samples before they were produced, and the last sample of a buffer
@ -533,14 +533,13 @@ impl BaseSrcImpl for SineSrc {
.unwrap(); .unwrap();
gst_debug!(self.cat, obj: element, "Returning latency {}", latency); gst_debug!(self.cat, obj: element, "Returning latency {}", latency);
q.set(settings.is_live, latency, gst::CLOCK_TIME_NONE); q.set(settings.is_live, latency, gst::CLOCK_TIME_NONE);
return true; true
} else { } else {
return false; false
} }
} }
_ => (), _ => BaseSrcImplExt::parent_query(self, element, query),
} }
BaseSrcImplExt::parent_query(self, element, query)
} }
// Creates the audio buffers // Creates the audio buffers