From dbeee31c89f7cf24f5c863abe005de9eaf58b2a8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 30 Sep 2015 10:51:38 +0200 Subject: [PATCH] Track stream state Keep track of the stream state better --- src/gst/gstpinossrc.c | 6 +++++- src/gst/gstpinossrc.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gst/gstpinossrc.c b/src/gst/gstpinossrc.c index 936816ec5..99bd177c0 100644 --- a/src/gst/gstpinossrc.c +++ b/src/gst/gstpinossrc.c @@ -272,7 +272,7 @@ fdpayload_data_destroy (gpointer user_data) pinos_buffer_builder_end (&b, &pbuf); GST_OBJECT_LOCK (pinossrc); - if (pinossrc->stream) + if (pinossrc->stream_state == PINOS_STREAM_STATE_STREAMING) pinos_stream_send_buffer (pinossrc->stream, &pbuf); GST_OBJECT_UNLOCK (pinossrc); @@ -379,6 +379,10 @@ on_stream_notify (GObject *gobject, GST_DEBUG ("got stream state %d", state); + GST_OBJECT_LOCK (pinossrc); + pinossrc->stream_state = state; + GST_OBJECT_UNLOCK (pinossrc); + switch (state) { case PINOS_STREAM_STATE_UNCONNECTED: case PINOS_STREAM_STATE_CONNECTING: diff --git a/src/gst/gstpinossrc.h b/src/gst/gstpinossrc.h index 05aed1a98..c3ed68bf5 100644 --- a/src/gst/gstpinossrc.h +++ b/src/gst/gstpinossrc.h @@ -61,6 +61,7 @@ struct _GstPinosSrc { PinosMainLoop *loop; PinosContext *ctx; PinosStream *stream; + PinosStreamState stream_state; GstAllocator *fd_allocator; GstBuffer *current;