Commit 407f311f authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

avwait: Fix clipping of audio buffers at the start of recording

parent af360dc6
......@@ -1202,9 +1202,23 @@ gst_avwait_asink_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
self->audio_running_time_to_end_at) == -1) {
/* Audio ends after start, but before end: clip */
GstSegment asegment2 = self->asegment;
guint64 start;
gint ssign;
ssign = gst_segment_position_from_running_time_full (&asegment2,
GST_FORMAT_TIME, self->audio_running_time_to_wait_for, &start);
if (ssign > 0) {
asegment2.start = start;
} else {
/* Starting before the start of the audio segment?! */
/* This shouldn't happen: we already know that the current audio is
* inside the segment, and that the end is after the current audio
* position */
("Failed to clip audio: it should have started before the current segment"),
gst_segment_set_running_time (&asegment2, GST_FORMAT_TIME,
inbuf =
gst_audio_buffer_clip (inbuf, &asegment2, self->ainfo.rate,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment