From c8bcb9db18fc115a0d656ce2bce9b891194192dc Mon Sep 17 00:00:00 2001 From: dhilshad Date: Fri, 17 Apr 2020 11:44:40 +0530 Subject: [PATCH] downloadbuffer:fix pushing buffer before stream start event downloadbuffer source pad pushes the first buffer before pushing Stream Start and Segment event, when working in Push mode. Fix:Pushing Stream Start and Segment after coming out of wait for data, and before pushing the buffer to next element. Fixes #534 --- plugins/elements/gstdownloadbuffer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/elements/gstdownloadbuffer.c b/plugins/elements/gstdownloadbuffer.c index ee287b4469..5e11133e8b 100644 --- a/plugins/elements/gstdownloadbuffer.c +++ b/plugins/elements/gstdownloadbuffer.c @@ -1317,6 +1317,10 @@ gst_download_buffer_loop (GstPad * pad) /* have to lock for thread-safety */ GST_DOWNLOAD_BUFFER_MUTEX_LOCK_CHECK (dlbuf, dlbuf->srcresult, out_flushing); + ret = gst_download_buffer_read_buffer (dlbuf, -1, -1, &buffer); + if (ret != GST_FLOW_OK) + goto out_flushing; + if (dlbuf->stream_start_event != NULL) { gst_pad_push_event (dlbuf->srcpad, dlbuf->stream_start_event); dlbuf->stream_start_event = NULL; @@ -1326,9 +1330,6 @@ gst_download_buffer_loop (GstPad * pad) dlbuf->segment_event = NULL; } - ret = gst_download_buffer_read_buffer (dlbuf, -1, -1, &buffer); - if (ret != GST_FLOW_OK) - goto out_flushing; /* update the buffering */ msg = update_buffering (dlbuf);