int _get_encoder_element_bitrate(GstElement *encoder, int *target_bitrate);
void _set_video_src_resolution(webrtc_gst_slot_s *source, int width, int height);
GstCaps *_make_video_raw_caps_with_resolution(webrtc_gst_slot_s *source, webrtc_ini_s *ini, int width, int height);
+void _release_request_pad(webrtc_gst_slot_s *source);
#endif /* __TIZEN_MEDIA_WEBRTC_SOURCE_COMMON_H__ */
return WEBRTC_ERROR_NONE;
}
-static gboolean __foreach_src_pad_cb(GstElement *element, GstPad *pad, gpointer user_data)
-{
- webrtc_gst_slot_s *source = (webrtc_gst_slot_s *)user_data;
- GstPad *peer = gst_pad_get_peer(pad);
-
- RET_VAL_IF(source == NULL, FALSE, "source is NULL");
- RET_VAL_IF(source->webrtc == NULL, FALSE, "webrtc is NULL");
- if (!peer) {
- LOG_DEBUG("peer pad is NULL");
- return TRUE;
- }
-
- LOG_DEBUG("about to release request pad[%s]", GST_PAD_NAME(peer));
-
- gst_element_release_request_pad(source->webrtc->gst.webrtcbin, peer);
-
- /* Two unrefing here, one for getting request pad, another one for getting peer pad */
- gst_object_unref(peer);
- gst_object_unref(peer);
-
- return TRUE;
-}
-
void _source_slot_destroy_cb(gpointer data)
{
webrtc_gst_slot_s *source = (webrtc_gst_slot_s *)data;
source->webrtc->gst.sources[i] = NULL;
}
- if (source->bin)
- gst_element_foreach_src_pad(GST_ELEMENT(source->bin), __foreach_src_pad_cb, source);
+ _release_request_pad(source);
for (i = 0; i < AV_IDX_MAX; i++) {
_remove_probe_from_pad_for_pause(source, i);
RET_IF(source->bin == NULL, "bin is NULL");
RET_IF(source->filesrc_pipeline == NULL, "filesrc_pipeline is NULL");
- gst_element_foreach_src_pad(GST_ELEMENT(source->bin), __foreach_src_pad_cb, source);
+ _release_request_pad(source);
for (av_idx = 0; av_idx < AV_IDX_MAX; av_idx++) {
GList *element_list = NULL;
return caps;
}
+
+static gboolean __foreach_src_pad_cb(GstElement *element, GstPad *pad, gpointer user_data)
+{
+ webrtc_gst_slot_s *source = (webrtc_gst_slot_s *)user_data;
+ GstPad *peer = gst_pad_get_peer(pad);
+
+ RET_VAL_IF(source == NULL, FALSE, "source is NULL");
+ RET_VAL_IF(source->webrtc == NULL, FALSE, "webrtc is NULL");
+ if (!peer) {
+ LOG_DEBUG("peer pad is NULL");
+ return TRUE;
+ }
+
+ LOG_DEBUG("about to release request pad[%s]", GST_PAD_NAME(peer));
+
+ gst_element_release_request_pad(source->webrtc->gst.webrtcbin, peer);
+
+ /* Two unrefing here, one for getting request pad, another one for getting peer pad */
+ gst_object_unref(peer);
+ gst_object_unref(peer);
+
+ return TRUE;
+}
+
+void _release_request_pad(webrtc_gst_slot_s *source)
+{
+ RET_IF(source == NULL, "source is NULL");
+
+ if (!source->bin)
+ return;
+
+ gst_element_foreach_src_pad(GST_ELEMENT(source->bin), __foreach_src_pad_cb, source);
+}