From: Sangchul Lee Date: Wed, 27 Dec 2023 00:47:36 +0000 (+0900) Subject: webrtc_source: Expand parameter to set ssrc later when making a rtp caps X-Git-Tag: accepted/tizen/8.0/unified/20240104.165415~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53c4de23d7b753cabc8debdbb20be94ed48ffe2a;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source: Expand parameter to set ssrc later when making a rtp caps If set it 0, it'll be set to a random number inside of gst plugin as it is. [Version] 0.4.27 [Issue Type] Improvement Change-Id: I2259ac28270709480c967fe1e40e3ef9551517dc Signed-off-by: Sangchul Lee (cherry picked from commit e09fe0750e51a0147878b83fed3e1432c48eb9cf) --- diff --git a/include/webrtc_source_private.h b/include/webrtc_source_private.h index 4df96935..ed583447 100644 --- a/include/webrtc_source_private.h +++ b/include/webrtc_source_private.h @@ -81,7 +81,7 @@ GstElement *_find_element_in_bin(GstBin *bin, const gchar *name); bool _is_hw_encoder_used(webrtc_s *webrtc, webrtc_media_source_type_e source_type, media_type_e media_type); GstCaps *_get_caps_from_encoded_audio_media_type(const char *media_type, int channels, int samplerate); GstCaps *_get_caps_from_encoded_video_media_type(const char *media_type, int width, int height); -GstCaps *_make_rtp_caps(const gchar *media_type, unsigned int payload_type, webrtc_gst_slot_s *source, GstElement *encoder); +GstCaps *_make_rtp_caps(const gchar *media_type, unsigned int payload_type, unsigned int ssrc, webrtc_gst_slot_s *source, GstElement *encoder); const char *_get_element_name(int av_idx, gst_element_e element); GstPadProbeReturn _payloaded_data_probe_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data); void _add_probe_to_pad_for_pause(webrtc_gst_slot_s *source, unsigned int idx, GstPad *pad, void *probe_cb); diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 66071e92..501d769a 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.4.26 +Version: 0.4.27 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source_file.c b/src/webrtc_source_file.c index 64dd5d57..3f7efcb7 100644 --- a/src/webrtc_source_file.c +++ b/src/webrtc_source_file.c @@ -323,7 +323,7 @@ static GstElement * __prepare_capsfilter_for_filesrc_pipeline(webrtc_gst_slot_s return NULL; } - if ((sink_caps = _make_rtp_caps(GET_MEDIA_TYPE_NAME(is_audio), source->av[GET_AV_IDX(is_audio)].pt, source, NULL))) { + if ((sink_caps = _make_rtp_caps(GET_MEDIA_TYPE_NAME(is_audio), source->av[GET_AV_IDX(is_audio)].pt, 0, source, NULL))) { g_object_set(G_OBJECT(capsfilter), "caps", sink_caps, NULL); gst_caps_unref(sink_caps); } diff --git a/src/webrtc_source_mediapacket.c b/src/webrtc_source_mediapacket.c index a28fe7d3..1e0b069d 100644 --- a/src/webrtc_source_mediapacket.c +++ b/src/webrtc_source_mediapacket.c @@ -333,7 +333,7 @@ static int __create_rest_of_elements_for_encoded_format(webrtc_s *webrtc, webrtc if (_set_payload_type(webrtc, source, GET_AV_IDX_BY_TYPE(source->media_types), NULL) != WEBRTC_ERROR_NONE) goto error; - if ((sink_caps = _make_rtp_caps(media_type, source->av[GET_AV_IDX_BY_TYPE(source->media_types)].pt, source, NULL))) { + if ((sink_caps = _make_rtp_caps(media_type, source->av[GET_AV_IDX_BY_TYPE(source->media_types)].pt, 0, source, NULL))) { g_object_set(G_OBJECT(capsfilter), "caps", sink_caps, NULL); gst_caps_unref(sink_caps); } @@ -862,7 +862,7 @@ int _update_pt_if_media_packet_source(webrtc_s *webrtc, webrtc_gst_slot_s *sourc idx = GET_AV_IDX_BY_TYPE(source->media_types); media_type = (idx == AV_IDX_AUDIO) ? _get_audio_media_type(source->av[idx].codec) : _get_video_media_type(source->av[idx].codec); - if (!(sink_caps = _make_rtp_caps(media_type, source->av[idx].pt, source, NULL))) + if (!(sink_caps = _make_rtp_caps(media_type, source->av[idx].pt, 0, source, NULL))) return WEBRTC_ERROR_INVALID_OPERATION; g_object_set(G_OBJECT(capsfilter), "caps", sink_caps, NULL); diff --git a/src/webrtc_source_private.c b/src/webrtc_source_private.c index b4b0a680..387f1594 100644 --- a/src/webrtc_source_private.c +++ b/src/webrtc_source_private.c @@ -198,7 +198,7 @@ static GstAudioFormat __get_gst_audio_raw_format_from_string(const char *format) return GST_AUDIO_FORMAT_UNKNOWN; } -GstCaps *_make_rtp_caps(const gchar *media_type, unsigned int payload_type, webrtc_gst_slot_s *source, GstElement *encoder) +GstCaps *_make_rtp_caps(const gchar *media_type, unsigned int payload_type, unsigned int ssrc, webrtc_gst_slot_s *source, GstElement *encoder) { GstCaps *caps; bool is_audio; @@ -211,6 +211,10 @@ GstCaps *_make_rtp_caps(const gchar *media_type, unsigned int payload_type, webr "media", G_TYPE_STRING, GET_MEDIA_TYPE_NAME(is_audio), "payload", G_TYPE_INT, payload_type, NULL); + if (ssrc != 0) + gst_caps_set_simple(caps, + "ssrc", G_TYPE_UINT, ssrc, + NULL); if (!is_audio || !source->av[AV_IDX_AUDIO].inbandfec) goto out; @@ -899,7 +903,7 @@ skip_encoder: if (_set_payload_type(webrtc, source, idx, media_type) != WEBRTC_ERROR_NONE) goto error; - if ((sink_caps = _make_rtp_caps(media_type, source->av[idx].pt, source, encoder))) { + if ((sink_caps = _make_rtp_caps(media_type, source->av[idx].pt, 0, source, encoder))) { g_object_set(G_OBJECT(rtp_capsfilter), "caps", sink_caps, NULL); gst_caps_unref(sink_caps); } @@ -1120,4 +1124,4 @@ GstCaps *_gst_set_caps_additional_fields(GstCaps *caps, GStrv key_value_pairs) return caps; } -//LCOV_EXCL_STOP \ No newline at end of file +//LCOV_EXCL_STOP