Ensure pre-roll frames are displayed when gstreamer backend is paused.

Perform a seek before transitioning from the stopped state to paused or
playing to force the pipeline to resupply the video sink with any
pre-roll buffer it may have previously ignored during loading.  And
don't assume showPrerollFrames to be true if the current state is not
stopped as the policy handling may have prevented an effectual state
change.

Change-Id: I288a70bc4da32f3534eab4b14702ca8f8fdb4222
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Andrew den Exter
2014-08-11 16:51:36 +10:00
committed by Andrew den Exter
parent 65d44edd3d
commit 3b20608fe3
4 changed files with 51 additions and 150 deletions

View File

@@ -84,9 +84,6 @@ public:
GstFlowReturn render(GstBuffer *buffer);
GstBuffer *lastPrerolledBuffer() const { return m_lastPrerolledBuffer; }
void setLastPrerolledBuffer(GstBuffer *lastPrerolledBuffer); // set prerolledBuffer to 0 to discard prerolled buffer
private slots:
void queuedStart();
void queuedStop();
@@ -108,8 +105,6 @@ private:
QVideoSurfaceFormat m_format;
QVideoFrame m_frame;
GstFlowReturn m_renderReturn;
// this pointer is not 0 when there is a prerolled buffer waiting to be displayed
GstBuffer *m_lastPrerolledBuffer;
int m_bytesPerLine;
bool m_started;
bool m_startCanceled;
@@ -126,8 +121,6 @@ public:
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
static void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer);
static void handleShowPrerollChange(GObject *o, GParamSpec *p, gpointer d);
private:
static GType get_type();
static void class_init(gpointer g_class, gpointer class_data);
@@ -147,11 +140,7 @@ private:
static gboolean start(GstBaseSink *sink);
static gboolean stop(GstBaseSink *sink);
static gboolean unlock(GstBaseSink *sink);
static gboolean event(GstBaseSink *sink, GstEvent *event);
static GstFlowReturn preroll(GstBaseSink *sink, GstBuffer *buffer);
static GstFlowReturn render(GstBaseSink *sink, GstBuffer *buffer);
static GstFlowReturn show_frame(GstVideoSink *sink, GstBuffer *buffer);
private:
QVideoSurfaceGstDelegate *delegate;