mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
uvcsink: refactor gst_uvc_sink_update_streaming
Move the sanity checks to the beginning of the function. Make the actual effect of the function more obvious and reset the flags in the end. This should make it easier to understand what this function is doing. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
This commit is contained in:
parent
6637343980
commit
1732f8c728
1 changed files with 8 additions and 12 deletions
|
@ -230,20 +230,16 @@ static GstPadProbeReturn gst_uvc_sink_sinkpad_event_peer_probe (GstPad * pad,
|
||||||
static void
|
static void
|
||||||
gst_uvc_sink_update_streaming (GstUvcSink * self)
|
gst_uvc_sink_update_streaming (GstUvcSink * self)
|
||||||
{
|
{
|
||||||
if (self->streamon) {
|
if (self->streamon && !self->streaming)
|
||||||
g_atomic_int_set (&self->streamon, FALSE);
|
GST_ERROR_OBJECT (self, "Unexpected STREAMON");
|
||||||
|
if (self->streamoff && self->streaming)
|
||||||
|
GST_ERROR_OBJECT (self, "Unexpected STREAMOFF");
|
||||||
|
|
||||||
|
if (self->streamon)
|
||||||
gst_uvc_sink_to_v4l2sink (self);
|
gst_uvc_sink_to_v4l2sink (self);
|
||||||
|
|
||||||
if (!self->streaming)
|
g_atomic_int_set (&self->streamon, FALSE);
|
||||||
GST_DEBUG_OBJECT (self, "something went wrong!");
|
g_atomic_int_set (&self->streamoff, FALSE);
|
||||||
}
|
|
||||||
|
|
||||||
if (self->streamoff) {
|
|
||||||
g_atomic_int_set (&self->streamoff, FALSE);
|
|
||||||
|
|
||||||
if (self->streaming)
|
|
||||||
GST_DEBUG_OBJECT (self, "something went wrong!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue