From 8ac445abd8e0d1e4bc49ff9759abf5e18294b818 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 25 Jul 2011 13:19:06 +0200 Subject: [PATCH] omxvideo{enc,dec}: Only set/unset flushing state on ports if they were created already --- omx/gstomxvideodec.c | 12 ++++++++---- omx/gstomxvideoenc.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 8eca754..644129e 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -317,14 +317,18 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition) ret = GST_STATE_CHANGE_FAILURE; break; case GST_STATE_CHANGE_READY_TO_PAUSED: - gst_omx_port_set_flushing (self->out_port, FALSE); - gst_omx_port_set_flushing (self->in_port, FALSE); + if (self->in_port) + gst_omx_port_set_flushing (self->in_port, FALSE); + if (self->out_port) + gst_omx_port_set_flushing (self->out_port, FALSE); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_omx_port_set_flushing (self->out_port, TRUE); - gst_omx_port_set_flushing (self->in_port, TRUE); + if (self->in_port) + gst_omx_port_set_flushing (self->in_port, TRUE); + if (self->out_port) + gst_omx_port_set_flushing (self->out_port, TRUE); break; default: break; diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index eb7564e..99c4801 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -312,14 +312,18 @@ gst_omx_video_enc_change_state (GstElement * element, GstStateChange transition) ret = GST_STATE_CHANGE_FAILURE; break; case GST_STATE_CHANGE_READY_TO_PAUSED: - gst_omx_port_set_flushing (self->out_port, FALSE); - gst_omx_port_set_flushing (self->in_port, FALSE); + if (self->in_port) + gst_omx_port_set_flushing (self->in_port, FALSE); + if (self->out_port) + gst_omx_port_set_flushing (self->out_port, FALSE); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_omx_port_set_flushing (self->out_port, TRUE); - gst_omx_port_set_flushing (self->in_port, TRUE); + if (self->in_port) + gst_omx_port_set_flushing (self->in_port, TRUE); + if (self->out_port) + gst_omx_port_set_flushing (self->out_port, TRUE); break; default: break; -- 2.7.4