mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 02:02:26 +00:00
pulsesink: don't use relative seeks
Don't use relative seeks, it's too hard to track where we are after a flush etc. fixes #593015
This commit is contained in:
parent
902fdb4b15
commit
abee4f1d64
1 changed files with 3 additions and 10 deletions
|
@ -106,7 +106,6 @@ struct _GstPulseRingBuffer
|
||||||
|
|
||||||
pa_sample_spec sample_spec;
|
pa_sample_spec sample_spec;
|
||||||
gint64 offset;
|
gint64 offset;
|
||||||
gint64 write_offset;
|
|
||||||
|
|
||||||
gboolean corked;
|
gboolean corked;
|
||||||
gboolean in_commit;
|
gboolean in_commit;
|
||||||
|
@ -677,7 +676,6 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
||||||
else
|
else
|
||||||
pbuf->offset = -gst_util_uint64_scale_int (-time_offset,
|
pbuf->offset = -gst_util_uint64_scale_int (-time_offset,
|
||||||
pbuf->sample_spec.rate, GST_SECOND);
|
pbuf->sample_spec.rate, GST_SECOND);
|
||||||
pbuf->write_offset = 0;
|
|
||||||
GST_LOG_OBJECT (psink, "sample offset %" G_GINT64_FORMAT, pbuf->offset);
|
GST_LOG_OBJECT (psink, "sample offset %" G_GINT64_FORMAT, pbuf->offset);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -1089,7 +1087,7 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
|
||||||
gboolean reverse;
|
gboolean reverse;
|
||||||
gint *toprocess;
|
gint *toprocess;
|
||||||
gint inr, outr, bps;
|
gint inr, outr, bps;
|
||||||
gint64 offset, diff;
|
gint64 offset;
|
||||||
guint bufsize;
|
guint bufsize;
|
||||||
|
|
||||||
pbuf = GST_PULSERING_BUFFER_CAST (buf);
|
pbuf = GST_PULSERING_BUFFER_CAST (buf);
|
||||||
|
@ -1155,9 +1153,6 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
|
||||||
/* offset is in bytes */
|
/* offset is in bytes */
|
||||||
offset *= bps;
|
offset *= bps;
|
||||||
|
|
||||||
diff = offset - pbuf->write_offset;
|
|
||||||
pbuf->write_offset = offset;
|
|
||||||
|
|
||||||
while (*toprocess > 0) {
|
while (*toprocess > 0) {
|
||||||
size_t avail;
|
size_t avail;
|
||||||
guint towrite;
|
guint towrite;
|
||||||
|
@ -1205,13 +1200,11 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
|
||||||
|
|
||||||
if (G_LIKELY (inr == outr && !reverse)) {
|
if (G_LIKELY (inr == outr && !reverse)) {
|
||||||
/* no rate conversion, simply write out the samples */
|
/* no rate conversion, simply write out the samples */
|
||||||
if (pa_stream_write (pbuf->stream, data, towrite, NULL, diff,
|
if (pa_stream_write (pbuf->stream, data, towrite, NULL, offset,
|
||||||
PA_SEEK_RELATIVE) < 0)
|
PA_SEEK_ABSOLUTE) < 0)
|
||||||
goto write_failed;
|
goto write_failed;
|
||||||
|
|
||||||
data += towrite;
|
data += towrite;
|
||||||
diff = 0;
|
|
||||||
pbuf->write_offset += towrite;
|
|
||||||
in_samples -= avail;
|
in_samples -= avail;
|
||||||
out_samples -= avail;
|
out_samples -= avail;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue