add pending_samples so that we only update segment's last stop after really sending the samples
This commit is contained in:
parent
5f802dad4e
commit
8009fcf547
@ -931,6 +931,8 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
|
|||||||
GST_TIME_ARGS (GST_BUFFER_DURATION (flacdec->pending)));
|
GST_TIME_ARGS (GST_BUFFER_DURATION (flacdec->pending)));
|
||||||
gst_pad_push (flacdec->srcpad, flacdec->pending);
|
gst_pad_push (flacdec->srcpad, flacdec->pending);
|
||||||
flacdec->pending = NULL;
|
flacdec->pending = NULL;
|
||||||
|
flacdec->segment.last_stop += flacdec->pending_samples;
|
||||||
|
flacdec->pending_samples = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
|
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
|
||||||
@ -1003,11 +1005,13 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
|
|||||||
}
|
}
|
||||||
ret = gst_pad_push (flacdec->srcpad, outbuf);
|
ret = gst_pad_push (flacdec->srcpad, outbuf);
|
||||||
GST_DEBUG_OBJECT (flacdec, "returned %s", gst_flow_get_name (ret));
|
GST_DEBUG_OBJECT (flacdec, "returned %s", gst_flow_get_name (ret));
|
||||||
|
flacdec->segment.last_stop += samples;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (flacdec,
|
GST_DEBUG_OBJECT (flacdec,
|
||||||
"not pushing %d samples at offset %" G_GINT64_FORMAT
|
"not pushing %d samples at offset %" G_GINT64_FORMAT
|
||||||
" (in seek)", samples, GST_BUFFER_OFFSET (outbuf));
|
" (in seek)", samples, GST_BUFFER_OFFSET (outbuf));
|
||||||
gst_buffer_replace (&flacdec->pending, outbuf);
|
gst_buffer_replace (&flacdec->pending, outbuf);
|
||||||
|
flacdec->pending_samples = samples;
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,7 +1022,6 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
flacdec->segment.last_stop += samples;
|
|
||||||
|
|
||||||
/* we act on the flow return value later in the loop function, as we don't
|
/* we act on the flow return value later in the loop function, as we don't
|
||||||
* want to mess up the internal decoder state by returning ABORT when the
|
* want to mess up the internal decoder state by returning ABORT when the
|
||||||
@ -1761,6 +1764,10 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event)
|
|||||||
|
|
||||||
flacdec->seeking = FALSE;
|
flacdec->seeking = FALSE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (flacdec, "performed seek to sample %" G_GINT64_FORMAT,
|
||||||
|
flacdec->segment.last_stop);
|
||||||
|
|
||||||
|
|
||||||
if (!seek_ok) {
|
if (!seek_ok) {
|
||||||
GST_WARNING_OBJECT (flacdec, "seek failed");
|
GST_WARNING_OBJECT (flacdec, "seek failed");
|
||||||
/* seek failed, restore the segment and start streaming again with
|
/* seek failed, restore the segment and start streaming again with
|
||||||
|
@ -69,6 +69,7 @@ struct _GstFlacDec {
|
|||||||
gboolean running;
|
gboolean running;
|
||||||
gboolean discont;
|
gboolean discont;
|
||||||
GstBuffer *pending; /* pending buffer, produced in seek */
|
GstBuffer *pending; /* pending buffer, produced in seek */
|
||||||
|
guint pending_samples;
|
||||||
GstEvent *close_segment;
|
GstEvent *close_segment;
|
||||||
GstEvent *start_segment;
|
GstEvent *start_segment;
|
||||||
GstTagList *tags;
|
GstTagList *tags;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user