LOG_DEBUG("source[id:%u, av_idx:%u] pad[%p] probe_id[%lu]",
source->id, idx, source->av[idx].src_pad, source->av[idx].src_pad_probe_id);
gst_pad_remove_probe(source->av[idx].src_pad, source->av[idx].src_pad_probe_id);
+ gst_element_remove_pad(GST_ELEMENT(source->bin), source->av[idx].src_pad);
source->av[idx].src_pad_probe_id = 0;
source->av[idx].src_pad = NULL;
}
return true;
}
+static void __remove_filesrc_element(webrtc_gst_slot_s *source)
+{
+ GstElement *payload = NULL;
+ GstElement *queue = NULL;
+ GstElement *capsfilter = NULL;
+
+ payload = gst_bin_get_by_name(source->bin, DEFAULT_NAME_AUDIO_PAYLOAD);
+ if (payload) {
+ queue = gst_bin_get_by_name(source->bin, DEFAULT_NAME_AUDIO_QUEUE);
+ capsfilter = gst_bin_get_by_name(source->bin, DEFAULT_NAME_AUDIO_CAPSFILTER);
+ gst_bin_remove_many(source->bin, payload, queue, capsfilter, NULL);
+
+ __remove_probe_from_pad_for_pause(source, AV_IDX_AUDIO);
+ }
+
+ payload = gst_bin_get_by_name(source->bin, DEFAULT_NAME_VIDEO_PAYLOAD);
+ if (payload) {
+ queue = gst_bin_get_by_name(source->bin, DEFAULT_NAME_VIDEO_QUEUE);
+ capsfilter = gst_bin_get_by_name(source->bin, DEFAULT_NAME_VIDEO_CAPSFILTER);
+ gst_bin_remove_many(source->bin, payload, queue, capsfilter, NULL);
+
+ __remove_probe_from_pad_for_pause(source, AV_IDX_VIDEO);
+ }
+}
+
int _set_media_path(webrtc_s *webrtc, unsigned int source_id, const char *path)
{
webrtc_gst_slot_s *source = NULL;
GstElement *filesrc = NULL;
+ gchar *location = NULL;
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0");
filesrc = gst_bin_get_by_name(source->bin, DEFAULT_NAME_FILE_SRC);
RET_VAL_IF(filesrc == NULL, WEBRTC_ERROR_INVALID_OPERATION, "filesrc is NULL");
+ g_object_get(G_OBJECT(filesrc), "location", &location, NULL);
+ if (location) {
+ __remove_filesrc_element(source);
+ g_free(location);
+ }
+
g_object_set(G_OBJECT(filesrc), "location", path, NULL);
LOG_DEBUG("source_id[%u] path[%s]", source_id, path);