mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
camerabin2: Handle audio elements states
Audio elements are put into bin only when needed, so we need to be careful with their states as camerabin2 won't manage them if they are outside the bin. Also we should reset their pad's flushing status before starting a new capture.
This commit is contained in:
parent
bbfd1c73dd
commit
fc9c9b0f24
1 changed files with 28 additions and 2 deletions
|
@ -202,10 +202,23 @@ gst_camera_bin_start_capture (GstCameraBin * camerabin)
|
|||
gst_object_unref (active_pad);
|
||||
}
|
||||
|
||||
if (camerabin->mode == MODE_VIDEO && camerabin->audio_src)
|
||||
gst_element_set_state (camerabin->audio_src, GST_STATE_PLAYING);
|
||||
if (camerabin->mode == MODE_VIDEO && camerabin->audio_src) {
|
||||
gst_element_set_state (camerabin->audio_src, GST_STATE_READY);
|
||||
/* need to reset eos status (pads could be flushing) */
|
||||
gst_element_set_state (camerabin->audio_queue, GST_STATE_READY);
|
||||
gst_element_set_state (camerabin->audio_convert, GST_STATE_READY);
|
||||
gst_element_set_state (camerabin->audio_capsfilter, GST_STATE_READY);
|
||||
gst_element_set_state (camerabin->audio_volume, GST_STATE_READY);
|
||||
|
||||
gst_element_sync_state_with_parent (camerabin->audio_queue);
|
||||
gst_element_sync_state_with_parent (camerabin->audio_convert);
|
||||
gst_element_sync_state_with_parent (camerabin->audio_capsfilter);
|
||||
gst_element_sync_state_with_parent (camerabin->audio_volume);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (camerabin->src, "start-capture", NULL);
|
||||
if (camerabin->mode == MODE_VIDEO && camerabin->audio_src)
|
||||
gst_element_set_state (camerabin->audio_src, GST_STATE_PLAYING);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -992,11 +1005,24 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans)
|
|||
gst_element_set_state (camera->audio_src, GST_STATE_READY);
|
||||
|
||||
gst_tag_setter_reset_tags (GST_TAG_SETTER (camera));
|
||||
|
||||
/* explicitly set to READY as they might be outside of the bin */
|
||||
gst_element_set_state (camera->audio_queue, GST_STATE_READY);
|
||||
gst_element_set_state (camera->audio_volume, GST_STATE_READY);
|
||||
gst_element_set_state (camera->audio_capsfilter, GST_STATE_READY);
|
||||
gst_element_set_state (camera->audio_convert, GST_STATE_READY);
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
gst_element_set_state (camera->videosink, GST_STATE_NULL);
|
||||
if (camera->audio_src)
|
||||
gst_element_set_state (camera->audio_src, GST_STATE_NULL);
|
||||
|
||||
/* explicitly set to NULL as they might be outside of the bin */
|
||||
gst_element_set_state (camera->audio_queue, GST_STATE_NULL);
|
||||
gst_element_set_state (camera->audio_volume, GST_STATE_NULL);
|
||||
gst_element_set_state (camera->audio_capsfilter, GST_STATE_NULL);
|
||||
gst_element_set_state (camera->audio_convert, GST_STATE_NULL);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue