webrtc_source: Expand parameter to set ssrc later when making a rtp caps 33/303533/1
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 27 Dec 2023 00:47:36 +0000 (09:47 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 2 Jan 2024 03:50:33 +0000 (03:50 +0000)
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 <sc11.lee@samsung.com>
(cherry picked from commit e09fe0750e51a0147878b83fed3e1432c48eb9cf)

include/webrtc_source_private.h
packaging/capi-media-webrtc.spec
src/webrtc_source_file.c
src/webrtc_source_mediapacket.c
src/webrtc_source_private.c

index 4df9693589c6facfaa7590de4bea42a27015173c..ed5834478e630b49fbb3b3f5844812a4c7f4bf1e 100644 (file)
@@ -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);
index 66071e92c75cb3bef199758346e4cb511fe0d143..501d769a12f8b74f82966a4cfaae5b537a3e0088 100644 (file)
@@ -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
index 64dd5d574c964cf54b414ca6a7526ee292939fc5..3f7efcb79b5fa7208e51672ddd662a28dc81babb 100644 (file)
@@ -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);
        }
index a28fe7d3e15ea2152e9e4ac0e322ff196370f193..1e0b069d739c8ffcaa5f78170175aa5d70c3fde3 100644 (file)
@@ -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);
index b4b0a6809f1ee60db61244fa3be09beff1e7ed36..387f1594349fcf41d353d9e9834a4e4933d2a44a 100644 (file)
@@ -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