mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
camerabin2: Reset last state change result on state-locked elements
An element stores the result for the last state change it did and GstBin's state change handler will use this last result for state locked elements to decide if its state change was successfull or not. In camerabin2, the filesinks have their state locked and when they fail switching states, this last failure will be used if the application tries to change camerabin2's state, causing any state change to fail. This patch makes camerabin2 reset this last change failure, avoiding that camerabin2 fails on its next state changes.
This commit is contained in:
parent
b872f84c96
commit
cc27a7fe3a
1 changed files with 12 additions and 2 deletions
|
@ -485,7 +485,12 @@ gst_camera_bin_src_notify_readyforcapture (GObject * obj, GParamSpec * pspec,
|
|||
GST_DEBUG_OBJECT (camera, "Switching videobin location to %s", location);
|
||||
g_object_set (camera->videosink, "location", location, NULL);
|
||||
g_free (location);
|
||||
gst_element_set_state (camera->videosink, GST_STATE_PLAYING);
|
||||
if (gst_element_set_state (camera->videosink, GST_STATE_PLAYING) ==
|
||||
GST_STATE_CHANGE_FAILURE) {
|
||||
/* Resets the latest state change return, that would be a failure
|
||||
* and could cause problems in a camerabin2 state change */
|
||||
gst_element_set_state (camera->videosink, GST_STATE_NULL);
|
||||
}
|
||||
gst_element_set_state (camera->video_encodebin, GST_STATE_PLAYING);
|
||||
gst_element_set_state (camera->videobin_capsfilter, GST_STATE_PLAYING);
|
||||
}
|
||||
|
@ -1219,7 +1224,12 @@ gst_camera_bin_image_sink_event_probe (GstPad * pad, GstEvent * event,
|
|||
GST_DEBUG_OBJECT (camerabin, "Setting filename to imagesink: %s",
|
||||
filename);
|
||||
g_object_set (camerabin->imagesink, "location", filename, NULL);
|
||||
gst_element_set_state (camerabin->imagesink, GST_STATE_PLAYING);
|
||||
if (gst_element_set_state (camerabin->imagesink, GST_STATE_PLAYING) ==
|
||||
GST_STATE_CHANGE_FAILURE) {
|
||||
/* Resets the latest state change return, that would be a failure
|
||||
* and could cause problems in a camerabin2 state change */
|
||||
gst_element_set_state (camerabin->imagesink, GST_STATE_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue