mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pipewiresrc: fix sending last buffer failure if waiting operation exits in advance
This commit is contained in:
parent
4b236f8274
commit
43441a4d69
1 changed files with 14 additions and 10 deletions
|
|
@ -1512,6 +1512,8 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
gboolean update_time = FALSE, timeout = FALSE;
|
gboolean update_time = FALSE, timeout = FALSE;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
struct timespec abstime = { 0, };
|
||||||
|
bool have_abstime = false;
|
||||||
|
|
||||||
pwsrc = GST_PIPEWIRE_SRC (psrc);
|
pwsrc = GST_PIPEWIRE_SRC (psrc);
|
||||||
|
|
||||||
|
|
@ -1555,13 +1557,11 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
|
||||||
update_time = TRUE;
|
update_time = TRUE;
|
||||||
GST_LOG_OBJECT (pwsrc, "EOS, send last buffer");
|
GST_LOG_OBJECT (pwsrc, "EOS, send last buffer");
|
||||||
break;
|
break;
|
||||||
} else if (timeout) {
|
} else if (timeout && pwsrc->last_buffer != NULL) {
|
||||||
if (pwsrc->last_buffer != NULL) {
|
update_time = TRUE;
|
||||||
update_time = TRUE;
|
buf = gst_buffer_ref(pwsrc->last_buffer);
|
||||||
buf = gst_buffer_ref(pwsrc->last_buffer);
|
GST_LOG_OBJECT (pwsrc, "timeout, send keepalive buffer");
|
||||||
GST_LOG_OBJECT (pwsrc, "timeout, send keepalive buffer");
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
buf = dequeue_buffer (pwsrc);
|
buf = dequeue_buffer (pwsrc);
|
||||||
GST_LOG_OBJECT (pwsrc, "popped buffer %p", buf);
|
GST_LOG_OBJECT (pwsrc, "popped buffer %p", buf);
|
||||||
|
|
@ -1573,9 +1573,13 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
|
||||||
}
|
}
|
||||||
timeout = FALSE;
|
timeout = FALSE;
|
||||||
if (pwsrc->keepalive_time > 0) {
|
if (pwsrc->keepalive_time > 0) {
|
||||||
struct timespec abstime;
|
if (!have_abstime) {
|
||||||
pw_thread_loop_get_time(pwsrc->stream->core->loop, &abstime,
|
/* Record the time we want to timeout at once, for this loop -- the loop might get unrelated signal()s,
|
||||||
pwsrc->keepalive_time * SPA_NSEC_PER_MSEC);
|
* and we don't want the keepalive time to get reset by that */
|
||||||
|
pw_thread_loop_get_time(pwsrc->stream->core->loop, &abstime,
|
||||||
|
pwsrc->keepalive_time * SPA_NSEC_PER_MSEC);
|
||||||
|
have_abstime = TRUE;
|
||||||
|
}
|
||||||
if (pw_thread_loop_timed_wait_full (pwsrc->stream->core->loop, &abstime) == -ETIMEDOUT)
|
if (pw_thread_loop_timed_wait_full (pwsrc->stream->core->loop, &abstime) == -ETIMEDOUT)
|
||||||
timeout = TRUE;
|
timeout = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue