summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-05-16 17:02:01 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-06-08 09:47:32 +0200
commit798bbc9acf97c8c480557294e3ea058a4d000f21 (patch)
tree11bf7020021f033e7515c9f7f72e3dcc44108262
parent2b48338d68b94392a293eeb507a08b93a6458564 (diff)
downloadgst-omx-798bbc9acf97c8c480557294e3ea058a4d000f21.tar.gz
omxvideoenc: factor out gst_omx_video_enc_pause_loop()
No semantic change. I'm going to use it in more failure cases. https://bugzilla.gnome.org/show_bug.cgi?id=796207
-rw-r--r--omx/gstomxvideodec.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index 1428ef8..5eb4295 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -1532,6 +1532,20 @@ copy_frame (const GstVideoInfo * info, GstBuffer * outbuf)
}
static void
+gst_omx_video_enc_pause_loop (GstOMXVideoDec * self, GstFlowReturn flow_ret)
+{
+ g_mutex_lock (&self->drain_lock);
+ if (self->draining) {
+ self->draining = FALSE;
+ g_cond_broadcast (&self->drain_cond);
+ }
+ gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
+ self->downstream_flow_ret = flow_ret;
+ self->started = FALSE;
+ g_mutex_unlock (&self->drain_lock);
+}
+
+static void
gst_omx_video_dec_loop (GstOMXVideoDec * self)
{
GstOMXPort *port;
@@ -1828,15 +1842,7 @@ component_error:
flushing:
{
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
- g_mutex_lock (&self->drain_lock);
- if (self->draining) {
- self->draining = FALSE;
- g_cond_broadcast (&self->drain_cond);
- }
- gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
- self->downstream_flow_ret = GST_FLOW_FLUSHING;
- self->started = FALSE;
- g_mutex_unlock (&self->drain_lock);
+ gst_omx_video_enc_pause_loop (self, GST_FLOW_FLUSHING);
return;
}
@@ -1894,14 +1900,7 @@ flow_error:
self->started = FALSE;
} else if (flow_ret == GST_FLOW_FLUSHING) {
GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
- g_mutex_lock (&self->drain_lock);
- if (self->draining) {
- self->draining = FALSE;
- g_cond_broadcast (&self->drain_cond);
- }
- gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
- self->started = FALSE;
- g_mutex_unlock (&self->drain_lock);
+ gst_omx_video_enc_pause_loop (self, flow_ret);
}
GST_VIDEO_DECODER_STREAM_UNLOCK (self);
return;