From: Hyunil Date: Thu, 25 Jun 2020 11:21:54 +0000 (+0900) Subject: Add error condition in media_streamer_prepare() for WebRTC X-Git-Tag: submit/tizen/20200714.065000~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F237170%2F4;p=platform%2Fcore%2Fapi%2Fmediastreamer.git Add error condition in media_streamer_prepare() for WebRTC - After setting media format to audio sink pad of WebRTC, if audio sink pad is not linked to peer node then an error will occur. - The video does the same thing. [Version] 0.1.75 [Issue Type] Improvement Change-Id: Iff9a9ce5a73f800e2fa0c9045cd470a9f6305d76 Signed-off-by: Hyunil --- diff --git a/packaging/capi-media-streamer.spec b/packaging/capi-media-streamer.spec index 50eca83..d753774 100644 --- a/packaging/capi-media-streamer.spec +++ b/packaging/capi-media-streamer.spec @@ -1,6 +1,6 @@ Name: capi-media-streamer Summary: A Media Streamer API -Version: 0.1.74 +Version: 0.1.75 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_streamer_node.c b/src/media_streamer_node.c index a862273..4b25214 100644 --- a/src/media_streamer_node.c +++ b/src/media_streamer_node.c @@ -1547,6 +1547,17 @@ static int __ms_webrtc_prepare_ghost_sink_pad(GstElement *webrtc_container, GstE return MEDIA_STREAMER_ERROR_NONE; } + if (!(ghost_pad_in = (GstGhostPad *)gst_element_get_static_pad(webrtc_container, pad_name))) { + ms_error("Failed to get ghost pad for webrtc_container"); + return MEDIA_STREAMER_ERROR_INVALID_OPERATION; + } + + if (!gst_pad_is_linked((GstPad *)ghost_pad_in)) { + ms_error("[%s] is set media format but not linked to peer node", pad_name); + MS_SAFE_UNREF(ghost_pad_in); + return MEDIA_STREAMER_ERROR_INVALID_OPERATION; + } + ms_info("%s is found, link it with webrtcbin and export the ghost pad[%s] of webrtc_container", capsfilter_name, pad_name); @@ -1563,11 +1574,7 @@ static int __ms_webrtc_prepare_ghost_sink_pad(GstElement *webrtc_container, GstE ret = MEDIA_STREAMER_ERROR_INVALID_OPERATION; goto end; } - if (!(ghost_pad_in = (GstGhostPad *)gst_element_get_static_pad(webrtc_container, pad_name))) { - ms_error("Failed to get ghost pad for webrtc_container"); - ret = MEDIA_STREAMER_ERROR_INVALID_OPERATION; - goto end; - } + if (!(filter_sink_pad = gst_element_get_static_pad(filter, "sink"))) { ms_error("Failed to get capsfilter sink pad in webrtc_container"); ret = MEDIA_STREAMER_ERROR_INVALID_OPERATION;